@venturewild/workspace 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +112 -112
- package/package.json +85 -85
- package/server/bin/wild-workspace.mjs +1096 -1096
- package/server/src/account.mjs +114 -114
- package/server/src/agent-login.mjs +146 -146
- package/server/src/agent-readiness.mjs +200 -200
- package/server/src/agent.mjs +468 -468
- package/server/src/bazaar/core.mjs +974 -974
- package/server/src/bazaar/index.mjs +88 -88
- package/server/src/bazaar/mcp-server.mjs +429 -429
- package/server/src/bazaar/mock-tickup.mjs +97 -97
- package/server/src/bazaar/preview-server.mjs +95 -95
- package/server/src/bazaar/seed-recipes/customer-feedback-form/know-how.md +23 -23
- package/server/src/bazaar/seed-recipes/customer-feedback-form/recipe.json +24 -24
- package/server/src/bazaar/seed-recipes/landing-page-launch/know-how.md +29 -29
- package/server/src/bazaar/seed-recipes/landing-page-launch/recipe.json +25 -25
- package/server/src/bazaar/seed-recipes/personal-portfolio/know-how.md +21 -21
- package/server/src/bazaar/seed-recipes/personal-portfolio/recipe.json +24 -24
- package/server/src/bazaar/seed-recipes/receipt-sorter/know-how.md +31 -31
- package/server/src/bazaar/seed-recipes/receipt-sorter/recipe.json +25 -25
- package/server/src/bazaar/seed-recipes/tickup-hr-matching/know-how.md +79 -79
- package/server/src/bazaar/seed-recipes/tickup-hr-matching/recipe.json +40 -40
- package/server/src/canvas/core.mjs +446 -446
- package/server/src/canvas/index.mjs +42 -42
- package/server/src/canvas/mcp-server.mjs +253 -253
- package/server/src/canvas-rails.mjs +108 -108
- package/server/src/config.mjs +404 -404
- package/server/src/daemon-bin.mjs +110 -110
- package/server/src/daemon-supervisor.mjs +285 -285
- package/server/src/doctor.mjs +375 -375
- package/server/src/inbox.mjs +86 -86
- package/server/src/index.mjs +3332 -3332
- package/server/src/listings-rails.mjs +156 -156
- package/server/src/logpaths.mjs +98 -98
- package/server/src/observability.mjs +45 -45
- package/server/src/operator.mjs +92 -92
- package/server/src/pairing.mjs +137 -137
- package/server/src/service.mjs +515 -515
- package/server/src/session-reporter.mjs +201 -201
- package/server/src/settings.mjs +145 -145
- package/server/src/share.mjs +182 -182
- package/server/src/skills.mjs +213 -213
- package/server/src/supervisor.mjs +647 -647
- package/server/src/support-consent.mjs +133 -133
- package/server/src/sync.mjs +248 -248
- package/server/src/transcript.mjs +121 -121
- package/server/src/turn-mcp.mjs +46 -46
- package/server/src/usage.mjs +405 -405
- package/server/src/workspace-registry.mjs +295 -295
- package/server/src/workspaces.mjs +145 -145
- package/web/dist/assets/index-BgFan7ls.js +131 -0
- package/web/dist/assets/index-DHts78rO.css +32 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-CzUrGoMW.css +0 -32
- package/web/dist/assets/index-ZYLNuQRa.js +0 -131
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var $l=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ba(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i0(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var rv={exports:{}},Nc={},iv={exports:{}},We={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var wa=Symbol.for("react.element"),s0=Symbol.for("react.portal"),o0=Symbol.for("react.fragment"),a0=Symbol.for("react.strict_mode"),l0=Symbol.for("react.profiler"),c0=Symbol.for("react.provider"),u0=Symbol.for("react.context"),h0=Symbol.for("react.forward_ref"),d0=Symbol.for("react.suspense"),f0=Symbol.for("react.memo"),p0=Symbol.for("react.lazy"),cm=Symbol.iterator;function m0(e){return e===null||typeof e!="object"?null:(e=cm&&e[cm]||e["@@iterator"],typeof e=="function"?e:null)}var sv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ov=Object.assign,av={};function no(e,t,n){this.props=e,this.context=t,this.refs=av,this.updater=n||sv}no.prototype.isReactComponent={};no.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};no.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lv(){}lv.prototype=no.prototype;function wf(e,t,n){this.props=e,this.context=t,this.refs=av,this.updater=n||sv}var Sf=wf.prototype=new lv;Sf.constructor=wf;ov(Sf,no.prototype);Sf.isPureReactComponent=!0;var um=Array.isArray,cv=Object.prototype.hasOwnProperty,xf={current:null},uv={key:!0,ref:!0,__self:!0,__source:!0};function hv(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)cv.call(t,r)&&!uv.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:wa,type:e,key:s,ref:o,props:i,_owner:xf.current}}function g0(e,t){return{$$typeof:wa,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function kf(e){return typeof e=="object"&&e!==null&&e.$$typeof===wa}function y0(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var hm=/\/+/g;function uu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?y0(""+e.key):t.toString(36)}function _l(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case wa:case s0:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+uu(o,0):r,um(i)?(n="",e!=null&&(n=e.replace(hm,"$&/")+"/"),_l(i,t,n,"",function(c){return c})):i!=null&&(kf(i)&&(i=g0(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(hm,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",um(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+uu(s,a);o+=_l(s,t,n,l,i)}else if(l=m0(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+uu(s,a++),o+=_l(s,t,n,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Ia(e,t,n){if(e==null)return e;var r=[],i=0;return _l(e,r,"","",function(s){return t.call(n,s,i++)}),r}function _0(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var wn={current:null},vl={transition:null},v0={ReactCurrentDispatcher:wn,ReactCurrentBatchConfig:vl,ReactCurrentOwner:xf};function dv(){throw Error("act(...) is not supported in production builds of React.")}We.Children={map:Ia,forEach:function(e,t,n){Ia(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ia(e,function(){t++}),t},toArray:function(e){return Ia(e,function(t){return t})||[]},only:function(e){if(!kf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};We.Component=no;We.Fragment=o0;We.Profiler=l0;We.PureComponent=wf;We.StrictMode=a0;We.Suspense=d0;We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=v0;We.act=dv;We.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=ov({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=xf.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)cv.call(t,l)&&!uv.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:wa,type:e.type,key:i,ref:s,props:r,_owner:o}};We.createContext=function(e){return e={$$typeof:u0,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:c0,_context:e},e.Consumer=e};We.createElement=hv;We.createFactory=function(e){var t=hv.bind(null,e);return t.type=e,t};We.createRef=function(){return{current:null}};We.forwardRef=function(e){return{$$typeof:h0,render:e}};We.isValidElement=kf;We.lazy=function(e){return{$$typeof:p0,_payload:{_status:-1,_result:e},_init:_0}};We.memo=function(e,t){return{$$typeof:f0,type:e,compare:t===void 0?null:t}};We.startTransition=function(e){var t=vl.transition;vl.transition={};try{e()}finally{vl.transition=t}};We.unstable_act=dv;We.useCallback=function(e,t){return wn.current.useCallback(e,t)};We.useContext=function(e){return wn.current.useContext(e)};We.useDebugValue=function(){};We.useDeferredValue=function(e){return wn.current.useDeferredValue(e)};We.useEffect=function(e,t){return wn.current.useEffect(e,t)};We.useId=function(){return wn.current.useId()};We.useImperativeHandle=function(e,t,n){return wn.current.useImperativeHandle(e,t,n)};We.useInsertionEffect=function(e,t){return wn.current.useInsertionEffect(e,t)};We.useLayoutEffect=function(e,t){return wn.current.useLayoutEffect(e,t)};We.useMemo=function(e,t){return wn.current.useMemo(e,t)};We.useReducer=function(e,t,n){return wn.current.useReducer(e,t,n)};We.useRef=function(e){return wn.current.useRef(e)};We.useState=function(e){return wn.current.useState(e)};We.useSyncExternalStore=function(e,t,n){return wn.current.useSyncExternalStore(e,t,n)};We.useTransition=function(){return wn.current.useTransition()};We.version="18.3.1";iv.exports=We;var w=iv.exports;const mr=ba(w);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var b0=w,w0=Symbol.for("react.element"),S0=Symbol.for("react.fragment"),x0=Object.prototype.hasOwnProperty,k0=b0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,C0={key:!0,ref:!0,__self:!0,__source:!0};function fv(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)x0.call(t,r)&&!C0.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:w0,type:e,key:s,ref:o,props:i,_owner:k0.current}}Nc.Fragment=S0;Nc.jsx=fv;Nc.jsxs=fv;rv.exports=Nc;var u=rv.exports,Ch={},pv={exports:{}},Un={},mv={exports:{}},gv={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(D,I){var C=D.length;D.push(I);e:for(;0<C;){var X=C-1>>>1,ie=D[X];if(0<i(ie,I))D[X]=I,D[C]=ie,C=X;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var I=D[0],C=D.pop();if(C!==I){D[0]=C;e:for(var X=0,ie=D.length,E=ie>>>1;X<E;){var ue=2*(X+1)-1,ve=D[ue],Z=ue+1,pe=D[Z];if(0>i(ve,C))Z<ie&&0>i(pe,ve)?(D[X]=pe,D[Z]=C,X=Z):(D[X]=ve,D[ue]=C,X=ue);else if(Z<ie&&0>i(pe,C))D[X]=pe,D[Z]=C,X=Z;else break e}}return I}function i(D,I){var C=D.sortIndex-I.sortIndex;return C!==0?C:D.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,h=null,f=3,m=!1,p=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(D){for(var I=n(c);I!==null;){if(I.callback===null)r(c);else if(I.startTime<=D)r(c),I.sortIndex=I.expirationTime,t(l,I);else break;I=n(c)}}function S(D){if(y=!1,g(D),!p)if(n(l)!==null)p=!0,O(k);else{var I=n(c);I!==null&&W(S,I.startTime-D)}}function k(D,I){p=!1,y&&(y=!1,_(L),L=-1),m=!0;var C=f;try{for(g(I),h=n(l);h!==null&&(!(h.expirationTime>I)||D&&!F());){var X=h.callback;if(typeof X=="function"){h.callback=null,f=h.priorityLevel;var ie=X(h.expirationTime<=I);I=e.unstable_now(),typeof ie=="function"?h.callback=ie:h===n(l)&&r(l),g(I)}else r(l);h=n(l)}if(h!==null)var E=!0;else{var ue=n(c);ue!==null&&W(S,ue.startTime-I),E=!1}return E}finally{h=null,f=C,m=!1}}var x=!1,T=null,L=-1,B=5,j=-1;function F(){return!(e.unstable_now()-j<B)}function A(){if(T!==null){var D=e.unstable_now();j=D;var I=!0;try{I=T(!0,D)}finally{I?R():(x=!1,T=null)}}else x=!1}var R;if(typeof v=="function")R=function(){v(A)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,N=P.port2;P.port1.onmessage=A,R=function(){N.postMessage(null)}}else R=function(){b(A,0)};function O(D){T=D,x||(x=!0,R())}function W(D,I){L=b(function(){D(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_continueExecution=function(){p||m||(p=!0,O(k))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(D){switch(f){case 1:case 2:case 3:var I=3;break;default:I=f}var C=f;f=I;try{return D()}finally{f=C}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,I){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var C=f;f=D;try{return I()}finally{f=C}},e.unstable_scheduleCallback=function(D,I,C){var X=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?X+C:X):C=X,D){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=C+ie,D={id:d++,callback:I,priorityLevel:D,startTime:C,expirationTime:ie,sortIndex:-1},C>X?(D.sortIndex=C,t(c,D),n(l)===null&&D===n(c)&&(y?(_(L),L=-1):y=!0,W(S,C-X))):(D.sortIndex=ie,t(l,D),p||m||(p=!0,O(k))),D},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(D){var I=f;return function(){var C=f;f=I;try{return D.apply(this,arguments)}finally{f=C}}}})(gv);mv.exports=gv;var E0=mv.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var N0=w,Wn=E0;function Y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var yv=new Set,Zo={};function us(e,t){Ks(e,t),Ks(e+"Capture",t)}function Ks(e,t){for(Zo[e]=t,e=0;e<t.length;e++)yv.add(t[e])}var Ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eh=Object.prototype.hasOwnProperty,j0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,dm={},fm={};function R0(e){return Eh.call(fm,e)?!0:Eh.call(dm,e)?!1:j0.test(e)?fm[e]=!0:(dm[e]=!0,!1)}function T0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function D0(e,t,n,r){if(t===null||typeof t>"u"||T0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Sn(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var an={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){an[e]=new Sn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];an[t]=new Sn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){an[e]=new Sn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){an[e]=new Sn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){an[e]=new Sn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){an[e]=new Sn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){an[e]=new Sn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){an[e]=new Sn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){an[e]=new Sn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Cf=/[\-:]([a-z])/g;function Ef(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Cf,Ef);an[t]=new Sn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Cf,Ef);an[t]=new Sn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Cf,Ef);an[t]=new Sn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){an[e]=new Sn(e,1,!1,e.toLowerCase(),null,!1,!1)});an.xlinkHref=new Sn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){an[e]=new Sn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Nf(e,t,n,r){var i=an.hasOwnProperty(t)?an[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(D0(t,n,i,r)&&(n=null),r||i===null?R0(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Yr=N0.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ma=Symbol.for("react.element"),xs=Symbol.for("react.portal"),ks=Symbol.for("react.fragment"),jf=Symbol.for("react.strict_mode"),Nh=Symbol.for("react.profiler"),_v=Symbol.for("react.provider"),vv=Symbol.for("react.context"),Rf=Symbol.for("react.forward_ref"),jh=Symbol.for("react.suspense"),Rh=Symbol.for("react.suspense_list"),Tf=Symbol.for("react.memo"),ai=Symbol.for("react.lazy"),bv=Symbol.for("react.offscreen"),pm=Symbol.iterator;function uo(e){return e===null||typeof e!="object"?null:(e=pm&&e[pm]||e["@@iterator"],typeof e=="function"?e:null)}var wt=Object.assign,hu;function Ro(e){if(hu===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);hu=t&&t[1]||""}return`
|
|
34
|
+
`+hu+e}var du=!1;function fu(e,t){if(!e||du)return"";du=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
35
|
+
`),s=r.stack.split(`
|
|
36
|
+
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
|
37
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{du=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ro(e):""}function P0(e){switch(e.tag){case 5:return Ro(e.type);case 16:return Ro("Lazy");case 13:return Ro("Suspense");case 19:return Ro("SuspenseList");case 0:case 2:case 15:return e=fu(e.type,!1),e;case 11:return e=fu(e.type.render,!1),e;case 1:return e=fu(e.type,!0),e;default:return""}}function Th(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ks:return"Fragment";case xs:return"Portal";case Nh:return"Profiler";case jf:return"StrictMode";case jh:return"Suspense";case Rh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case vv:return(e.displayName||"Context")+".Consumer";case _v:return(e._context.displayName||"Context")+".Provider";case Rf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Tf:return t=e.displayName||null,t!==null?t:Th(e.type)||"Memo";case ai:t=e._payload,e=e._init;try{return Th(e(t))}catch{}}return null}function L0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Th(t);case 8:return t===jf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ki(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function wv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function A0(e){var t=wv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Oa(e){e._valueTracker||(e._valueTracker=A0(e))}function Sv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=wv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Dh(e,t){var n=t.checked;return wt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ki(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function xv(e,t){t=t.checked,t!=null&&Nf(e,"checked",t,!1)}function Ph(e,t){xv(e,t);var n=ki(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Lh(e,t.type,n):t.hasOwnProperty("defaultValue")&&Lh(e,t.type,ki(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Lh(e,t,n){(t!=="number"||Hl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var To=Array.isArray;function zs(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ki(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ah(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Y(91));return wt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ym(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Y(92));if(To(n)){if(1<n.length)throw Error(Y(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ki(n)}}function kv(e,t){var n=ki(t.value),r=ki(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function _m(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Cv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ih(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Cv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var za,Ev=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(za=za||document.createElement("div"),za.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=za.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Qo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},I0=["Webkit","ms","Moz","O"];Object.keys(Bo).forEach(function(e){I0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Bo[t]=Bo[e]})});function Nv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Bo.hasOwnProperty(e)&&Bo[e]?(""+t).trim():t+"px"}function jv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Nv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var M0=wt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Mh(e,t){if(t){if(M0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Y(62))}}function Oh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zh=null;function Df(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bh=null,Bs=null,Fs=null;function vm(e){if(e=ka(e)){if(typeof Bh!="function")throw Error(Y(280));var t=e.stateNode;t&&(t=Pc(t),Bh(e.stateNode,e.type,t))}}function Rv(e){Bs?Fs?Fs.push(e):Fs=[e]:Bs=e}function Tv(){if(Bs){var e=Bs,t=Fs;if(Fs=Bs=null,vm(e),t)for(e=0;e<t.length;e++)vm(t[e])}}function Dv(e,t){return e(t)}function Pv(){}var pu=!1;function Lv(e,t,n){if(pu)return e(t,n);pu=!0;try{return Dv(e,t,n)}finally{pu=!1,(Bs!==null||Fs!==null)&&(Pv(),Tv())}}function ea(e,t){var n=e.stateNode;if(n===null)return null;var r=Pc(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Y(231,t,typeof n));return n}var Fh=!1;if(Ur)try{var ho={};Object.defineProperty(ho,"passive",{get:function(){Fh=!0}}),window.addEventListener("test",ho,ho),window.removeEventListener("test",ho,ho)}catch{Fh=!1}function O0(e,t,n,r,i,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(d){this.onError(d)}}var Fo=!1,Wl=null,Ul=!1,$h=null,z0={onError:function(e){Fo=!0,Wl=e}};function B0(e,t,n,r,i,s,o,a,l){Fo=!1,Wl=null,O0.apply(z0,arguments)}function F0(e,t,n,r,i,s,o,a,l){if(B0.apply(this,arguments),Fo){if(Fo){var c=Wl;Fo=!1,Wl=null}else throw Error(Y(198));Ul||(Ul=!0,$h=c)}}function hs(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Av(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function bm(e){if(hs(e)!==e)throw Error(Y(188))}function $0(e){var t=e.alternate;if(!t){if(t=hs(e),t===null)throw Error(Y(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return bm(i),e;if(s===r)return bm(i),t;s=s.sibling}throw Error(Y(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(Y(189))}}if(n.alternate!==r)throw Error(Y(190))}if(n.tag!==3)throw Error(Y(188));return n.stateNode.current===n?e:t}function Iv(e){return e=$0(e),e!==null?Mv(e):null}function Mv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Mv(e);if(t!==null)return t;e=e.sibling}return null}var Ov=Wn.unstable_scheduleCallback,wm=Wn.unstable_cancelCallback,H0=Wn.unstable_shouldYield,W0=Wn.unstable_requestPaint,At=Wn.unstable_now,U0=Wn.unstable_getCurrentPriorityLevel,Pf=Wn.unstable_ImmediatePriority,zv=Wn.unstable_UserBlockingPriority,Vl=Wn.unstable_NormalPriority,V0=Wn.unstable_LowPriority,Bv=Wn.unstable_IdlePriority,jc=null,jr=null;function q0(e){if(jr&&typeof jr.onCommitFiberRoot=="function")try{jr.onCommitFiberRoot(jc,e,void 0,(e.current.flags&128)===128)}catch{}}var dr=Math.clz32?Math.clz32:G0,K0=Math.log,Y0=Math.LN2;function G0(e){return e>>>=0,e===0?32:31-(K0(e)/Y0|0)|0}var Ba=64,Fa=4194304;function Do(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ql(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Do(a):(s&=o,s!==0&&(r=Do(s)))}else o=n&~i,o!==0?r=Do(o):s!==0&&(r=Do(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-dr(t),i=1<<n,r|=e[n],t&=~i;return r}function X0(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function J0(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-dr(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=X0(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function Hh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Fv(){var e=Ba;return Ba<<=1,!(Ba&4194240)&&(Ba=64),e}function mu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Sa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-dr(t),e[t]=n}function Z0(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-dr(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function Lf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-dr(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Qe=0;function $v(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Hv,Af,Wv,Uv,Vv,Wh=!1,$a=[],mi=null,gi=null,yi=null,ta=new Map,na=new Map,ui=[],Q0="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Sm(e,t){switch(e){case"focusin":case"focusout":mi=null;break;case"dragenter":case"dragleave":gi=null;break;case"mouseover":case"mouseout":yi=null;break;case"pointerover":case"pointerout":ta.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":na.delete(t.pointerId)}}function fo(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=ka(t),t!==null&&Af(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function e1(e,t,n,r,i){switch(t){case"focusin":return mi=fo(mi,e,t,n,r,i),!0;case"dragenter":return gi=fo(gi,e,t,n,r,i),!0;case"mouseover":return yi=fo(yi,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return ta.set(s,fo(ta.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,na.set(s,fo(na.get(s)||null,e,t,n,r,i)),!0}return!1}function qv(e){var t=Vi(e.target);if(t!==null){var n=hs(t);if(n!==null){if(t=n.tag,t===13){if(t=Av(n),t!==null){e.blockedOn=t,Vv(e.priority,function(){Wv(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function bl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Uh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);zh=r,n.target.dispatchEvent(r),zh=null}else return t=ka(n),t!==null&&Af(t),e.blockedOn=n,!1;t.shift()}return!0}function xm(e,t,n){bl(e)&&n.delete(t)}function t1(){Wh=!1,mi!==null&&bl(mi)&&(mi=null),gi!==null&&bl(gi)&&(gi=null),yi!==null&&bl(yi)&&(yi=null),ta.forEach(xm),na.forEach(xm)}function po(e,t){e.blockedOn===t&&(e.blockedOn=null,Wh||(Wh=!0,Wn.unstable_scheduleCallback(Wn.unstable_NormalPriority,t1)))}function ra(e){function t(i){return po(i,e)}if(0<$a.length){po($a[0],e);for(var n=1;n<$a.length;n++){var r=$a[n];r.blockedOn===e&&(r.blockedOn=null)}}for(mi!==null&&po(mi,e),gi!==null&&po(gi,e),yi!==null&&po(yi,e),ta.forEach(t),na.forEach(t),n=0;n<ui.length;n++)r=ui[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ui.length&&(n=ui[0],n.blockedOn===null);)qv(n),n.blockedOn===null&&ui.shift()}var $s=Yr.ReactCurrentBatchConfig,Kl=!0;function n1(e,t,n,r){var i=Qe,s=$s.transition;$s.transition=null;try{Qe=1,If(e,t,n,r)}finally{Qe=i,$s.transition=s}}function r1(e,t,n,r){var i=Qe,s=$s.transition;$s.transition=null;try{Qe=4,If(e,t,n,r)}finally{Qe=i,$s.transition=s}}function If(e,t,n,r){if(Kl){var i=Uh(e,t,n,r);if(i===null)Cu(e,t,r,Yl,n),Sm(e,r);else if(e1(i,e,t,n,r))r.stopPropagation();else if(Sm(e,r),t&4&&-1<Q0.indexOf(e)){for(;i!==null;){var s=ka(i);if(s!==null&&Hv(s),s=Uh(e,t,n,r),s===null&&Cu(e,t,r,Yl,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Cu(e,t,r,null,n)}}var Yl=null;function Uh(e,t,n,r){if(Yl=null,e=Df(r),e=Vi(e),e!==null)if(t=hs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Av(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yl=e,null}function Kv(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(U0()){case Pf:return 1;case zv:return 4;case Vl:case V0:return 16;case Bv:return 536870912;default:return 16}default:return 16}}var di=null,Mf=null,wl=null;function Yv(){if(wl)return wl;var e,t=Mf,n=t.length,r,i="value"in di?di.value:di.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return wl=i.slice(e,1<r?1-r:void 0)}function Sl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ha(){return!0}function km(){return!1}function Vn(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Ha:km,this.isPropagationStopped=km,this}return wt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ha)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ha)},persist:function(){},isPersistent:Ha}),t}var ro={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Of=Vn(ro),xa=wt({},ro,{view:0,detail:0}),i1=Vn(xa),gu,yu,mo,Rc=wt({},xa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==mo&&(mo&&e.type==="mousemove"?(gu=e.screenX-mo.screenX,yu=e.screenY-mo.screenY):yu=gu=0,mo=e),gu)},movementY:function(e){return"movementY"in e?e.movementY:yu}}),Cm=Vn(Rc),s1=wt({},Rc,{dataTransfer:0}),o1=Vn(s1),a1=wt({},xa,{relatedTarget:0}),_u=Vn(a1),l1=wt({},ro,{animationName:0,elapsedTime:0,pseudoElement:0}),c1=Vn(l1),u1=wt({},ro,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),h1=Vn(u1),d1=wt({},ro,{data:0}),Em=Vn(d1),f1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p1={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},m1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=m1[e])?!!t[e]:!1}function zf(){return g1}var y1=wt({},xa,{key:function(e){if(e.key){var t=f1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Sl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?p1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zf,charCode:function(e){return e.type==="keypress"?Sl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Sl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_1=Vn(y1),v1=wt({},Rc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nm=Vn(v1),b1=wt({},xa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zf}),w1=Vn(b1),S1=wt({},ro,{propertyName:0,elapsedTime:0,pseudoElement:0}),x1=Vn(S1),k1=wt({},Rc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),C1=Vn(k1),E1=[9,13,27,32],Bf=Ur&&"CompositionEvent"in window,$o=null;Ur&&"documentMode"in document&&($o=document.documentMode);var N1=Ur&&"TextEvent"in window&&!$o,Gv=Ur&&(!Bf||$o&&8<$o&&11>=$o),jm=" ",Rm=!1;function Xv(e,t){switch(e){case"keyup":return E1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Cs=!1;function j1(e,t){switch(e){case"compositionend":return Jv(t);case"keypress":return t.which!==32?null:(Rm=!0,jm);case"textInput":return e=t.data,e===jm&&Rm?null:e;default:return null}}function R1(e,t){if(Cs)return e==="compositionend"||!Bf&&Xv(e,t)?(e=Yv(),wl=Mf=di=null,Cs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Gv&&t.locale!=="ko"?null:t.data;default:return null}}var T1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Tm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!T1[e.type]:t==="textarea"}function Zv(e,t,n,r){Rv(r),t=Gl(t,"onChange"),0<t.length&&(n=new Of("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ho=null,ia=null;function D1(e){cb(e,0)}function Tc(e){var t=js(e);if(Sv(t))return e}function P1(e,t){if(e==="change")return t}var Qv=!1;if(Ur){var vu;if(Ur){var bu="oninput"in document;if(!bu){var Dm=document.createElement("div");Dm.setAttribute("oninput","return;"),bu=typeof Dm.oninput=="function"}vu=bu}else vu=!1;Qv=vu&&(!document.documentMode||9<document.documentMode)}function Pm(){Ho&&(Ho.detachEvent("onpropertychange",eb),ia=Ho=null)}function eb(e){if(e.propertyName==="value"&&Tc(ia)){var t=[];Zv(t,ia,e,Df(e)),Lv(D1,t)}}function L1(e,t,n){e==="focusin"?(Pm(),Ho=t,ia=n,Ho.attachEvent("onpropertychange",eb)):e==="focusout"&&Pm()}function A1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tc(ia)}function I1(e,t){if(e==="click")return Tc(t)}function M1(e,t){if(e==="input"||e==="change")return Tc(t)}function O1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gr=typeof Object.is=="function"?Object.is:O1;function sa(e,t){if(gr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Eh.call(t,i)||!gr(e[i],t[i]))return!1}return!0}function Lm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Am(e,t){var n=Lm(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Lm(n)}}function tb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?tb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function nb(){for(var e=window,t=Hl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Hl(e.document)}return t}function Ff(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function z1(e){var t=nb(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&tb(n.ownerDocument.documentElement,n)){if(r!==null&&Ff(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Am(n,s);var o=Am(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var B1=Ur&&"documentMode"in document&&11>=document.documentMode,Es=null,Vh=null,Wo=null,qh=!1;function Im(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qh||Es==null||Es!==Hl(r)||(r=Es,"selectionStart"in r&&Ff(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Wo&&sa(Wo,r)||(Wo=r,r=Gl(Vh,"onSelect"),0<r.length&&(t=new Of("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Es)))}function Wa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ns={animationend:Wa("Animation","AnimationEnd"),animationiteration:Wa("Animation","AnimationIteration"),animationstart:Wa("Animation","AnimationStart"),transitionend:Wa("Transition","TransitionEnd")},wu={},rb={};Ur&&(rb=document.createElement("div").style,"AnimationEvent"in window||(delete Ns.animationend.animation,delete Ns.animationiteration.animation,delete Ns.animationstart.animation),"TransitionEvent"in window||delete Ns.transitionend.transition);function Dc(e){if(wu[e])return wu[e];if(!Ns[e])return e;var t=Ns[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in rb)return wu[e]=t[n];return e}var ib=Dc("animationend"),sb=Dc("animationiteration"),ob=Dc("animationstart"),ab=Dc("transitionend"),lb=new Map,Mm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ni(e,t){lb.set(e,t),us(t,[e])}for(var Su=0;Su<Mm.length;Su++){var xu=Mm[Su],F1=xu.toLowerCase(),$1=xu[0].toUpperCase()+xu.slice(1);Ni(F1,"on"+$1)}Ni(ib,"onAnimationEnd");Ni(sb,"onAnimationIteration");Ni(ob,"onAnimationStart");Ni("dblclick","onDoubleClick");Ni("focusin","onFocus");Ni("focusout","onBlur");Ni(ab,"onTransitionEnd");Ks("onMouseEnter",["mouseout","mouseover"]);Ks("onMouseLeave",["mouseout","mouseover"]);Ks("onPointerEnter",["pointerout","pointerover"]);Ks("onPointerLeave",["pointerout","pointerover"]);us("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));us("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));us("onBeforeInput",["compositionend","keypress","textInput","paste"]);us("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));us("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));us("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Po="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),H1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Po));function Om(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,F0(r,t,void 0,e),e.currentTarget=null}function cb(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;Om(i,a,c),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;Om(i,a,c),s=l}}}if(Ul)throw e=$h,Ul=!1,$h=null,e}function ct(e,t){var n=t[Jh];n===void 0&&(n=t[Jh]=new Set);var r=e+"__bubble";n.has(r)||(ub(t,e,2,!1),n.add(r))}function ku(e,t,n){var r=0;t&&(r|=4),ub(n,e,r,t)}var Ua="_reactListening"+Math.random().toString(36).slice(2);function oa(e){if(!e[Ua]){e[Ua]=!0,yv.forEach(function(n){n!=="selectionchange"&&(H1.has(n)||ku(n,!1,e),ku(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ua]||(t[Ua]=!0,ku("selectionchange",!1,t))}}function ub(e,t,n,r){switch(Kv(t)){case 1:var i=n1;break;case 4:i=r1;break;default:i=If}n=i.bind(null,t,n,e),i=void 0,!Fh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Cu(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=Vi(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}Lv(function(){var c=s,d=Df(n),h=[];e:{var f=lb.get(e);if(f!==void 0){var m=Of,p=e;switch(e){case"keypress":if(Sl(n)===0)break e;case"keydown":case"keyup":m=_1;break;case"focusin":p="focus",m=_u;break;case"focusout":p="blur",m=_u;break;case"beforeblur":case"afterblur":m=_u;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Cm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=o1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=w1;break;case ib:case sb:case ob:m=c1;break;case ab:m=x1;break;case"scroll":m=i1;break;case"wheel":m=C1;break;case"copy":case"cut":case"paste":m=h1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Nm}var y=(t&4)!==0,b=!y&&e==="scroll",_=y?f!==null?f+"Capture":null:f;y=[];for(var v=c,g;v!==null;){g=v;var S=g.stateNode;if(g.tag===5&&S!==null&&(g=S,_!==null&&(S=ea(v,_),S!=null&&y.push(aa(v,S,g)))),b)break;v=v.return}0<y.length&&(f=new m(f,p,null,n,d),h.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==zh&&(p=n.relatedTarget||n.fromElement)&&(Vi(p)||p[Vr]))break e;if((m||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?Vi(p):null,p!==null&&(b=hs(p),p!==b||p.tag!==5&&p.tag!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=Cm,S="onMouseLeave",_="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=Nm,S="onPointerLeave",_="onPointerEnter",v="pointer"),b=m==null?f:js(m),g=p==null?f:js(p),f=new y(S,v+"leave",m,n,d),f.target=b,f.relatedTarget=g,S=null,Vi(d)===c&&(y=new y(_,v+"enter",p,n,d),y.target=g,y.relatedTarget=b,S=y),b=S,m&&p)t:{for(y=m,_=p,v=0,g=y;g;g=ps(g))v++;for(g=0,S=_;S;S=ps(S))g++;for(;0<v-g;)y=ps(y),v--;for(;0<g-v;)_=ps(_),g--;for(;v--;){if(y===_||_!==null&&y===_.alternate)break t;y=ps(y),_=ps(_)}y=null}else y=null;m!==null&&zm(h,f,m,y,!1),p!==null&&b!==null&&zm(h,b,p,y,!0)}}e:{if(f=c?js(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var k=P1;else if(Tm(f))if(Qv)k=M1;else{k=A1;var x=L1}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=I1);if(k&&(k=k(e,c))){Zv(h,k,n,d);break e}x&&x(e,f,c),e==="focusout"&&(x=f._wrapperState)&&x.controlled&&f.type==="number"&&Lh(f,"number",f.value)}switch(x=c?js(c):window,e){case"focusin":(Tm(x)||x.contentEditable==="true")&&(Es=x,Vh=c,Wo=null);break;case"focusout":Wo=Vh=Es=null;break;case"mousedown":qh=!0;break;case"contextmenu":case"mouseup":case"dragend":qh=!1,Im(h,n,d);break;case"selectionchange":if(B1)break;case"keydown":case"keyup":Im(h,n,d)}var T;if(Bf)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else Cs?Xv(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(Gv&&n.locale!=="ko"&&(Cs||L!=="onCompositionStart"?L==="onCompositionEnd"&&Cs&&(T=Yv()):(di=d,Mf="value"in di?di.value:di.textContent,Cs=!0)),x=Gl(c,L),0<x.length&&(L=new Em(L,e,null,n,d),h.push({event:L,listeners:x}),T?L.data=T:(T=Jv(n),T!==null&&(L.data=T)))),(T=N1?j1(e,n):R1(e,n))&&(c=Gl(c,"onBeforeInput"),0<c.length&&(d=new Em("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:c}),d.data=T))}cb(h,t)})}function aa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Gl(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=ea(e,n),s!=null&&r.unshift(aa(e,s,i)),s=ea(e,t),s!=null&&r.push(aa(e,s,i))),e=e.return}return r}function ps(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function zm(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=ea(n,s),l!=null&&o.unshift(aa(n,l,a))):i||(l=ea(n,s),l!=null&&o.push(aa(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var W1=/\r\n?/g,U1=/\u0000|\uFFFD/g;function Bm(e){return(typeof e=="string"?e:""+e).replace(W1,`
|
|
38
|
+
`).replace(U1,"")}function Va(e,t,n){if(t=Bm(t),Bm(e)!==t&&n)throw Error(Y(425))}function Xl(){}var Kh=null,Yh=null;function Gh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xh=typeof setTimeout=="function"?setTimeout:void 0,V1=typeof clearTimeout=="function"?clearTimeout:void 0,Fm=typeof Promise=="function"?Promise:void 0,q1=typeof queueMicrotask=="function"?queueMicrotask:typeof Fm<"u"?function(e){return Fm.resolve(null).then(e).catch(K1)}:Xh;function K1(e){setTimeout(function(){throw e})}function Eu(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),ra(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);ra(t)}function _i(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function $m(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var io=Math.random().toString(36).slice(2),Er="__reactFiber$"+io,la="__reactProps$"+io,Vr="__reactContainer$"+io,Jh="__reactEvents$"+io,Y1="__reactListeners$"+io,G1="__reactHandles$"+io;function Vi(e){var t=e[Er];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Vr]||n[Er]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$m(e);e!==null;){if(n=e[Er])return n;e=$m(e)}return t}e=n,n=e.parentNode}return null}function ka(e){return e=e[Er]||e[Vr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function js(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Y(33))}function Pc(e){return e[la]||null}var Zh=[],Rs=-1;function ji(e){return{current:e}}function ht(e){0>Rs||(e.current=Zh[Rs],Zh[Rs]=null,Rs--)}function ot(e,t){Rs++,Zh[Rs]=e.current,e.current=t}var Ci={},pn=ji(Ci),Rn=ji(!1),es=Ci;function Ys(e,t){var n=e.type.contextTypes;if(!n)return Ci;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Tn(e){return e=e.childContextTypes,e!=null}function Jl(){ht(Rn),ht(pn)}function Hm(e,t,n){if(pn.current!==Ci)throw Error(Y(168));ot(pn,t),ot(Rn,n)}function hb(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Y(108,L0(e)||"Unknown",i));return wt({},n,r)}function Zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ci,es=pn.current,ot(pn,e),ot(Rn,Rn.current),!0}function Wm(e,t,n){var r=e.stateNode;if(!r)throw Error(Y(169));n?(e=hb(e,t,es),r.__reactInternalMemoizedMergedChildContext=e,ht(Rn),ht(pn),ot(pn,e)):ht(Rn),ot(Rn,n)}var Or=null,Lc=!1,Nu=!1;function db(e){Or===null?Or=[e]:Or.push(e)}function X1(e){Lc=!0,db(e)}function Ri(){if(!Nu&&Or!==null){Nu=!0;var e=0,t=Qe;try{var n=Or;for(Qe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Or=null,Lc=!1}catch(i){throw Or!==null&&(Or=Or.slice(e+1)),Ov(Pf,Ri),i}finally{Qe=t,Nu=!1}}return null}var Ts=[],Ds=0,Ql=null,ec=0,Jn=[],Zn=0,ts=null,Br=1,Fr="";function Bi(e,t){Ts[Ds++]=ec,Ts[Ds++]=Ql,Ql=e,ec=t}function fb(e,t,n){Jn[Zn++]=Br,Jn[Zn++]=Fr,Jn[Zn++]=ts,ts=e;var r=Br;e=Fr;var i=32-dr(r)-1;r&=~(1<<i),n+=1;var s=32-dr(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Br=1<<32-dr(t)+i|n<<i|r,Fr=s+e}else Br=1<<s|n<<i|r,Fr=e}function $f(e){e.return!==null&&(Bi(e,1),fb(e,1,0))}function Hf(e){for(;e===Ql;)Ql=Ts[--Ds],Ts[Ds]=null,ec=Ts[--Ds],Ts[Ds]=null;for(;e===ts;)ts=Jn[--Zn],Jn[Zn]=null,Fr=Jn[--Zn],Jn[Zn]=null,Br=Jn[--Zn],Jn[Zn]=null}var $n=null,Fn=null,ft=!1,hr=null;function pb(e,t){var n=er(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Um(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,$n=e,Fn=_i(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,$n=e,Fn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ts!==null?{id:Br,overflow:Fr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=er(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,$n=e,Fn=null,!0):!1;default:return!1}}function Qh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ed(e){if(ft){var t=Fn;if(t){var n=t;if(!Um(e,t)){if(Qh(e))throw Error(Y(418));t=_i(n.nextSibling);var r=$n;t&&Um(e,t)?pb(r,n):(e.flags=e.flags&-4097|2,ft=!1,$n=e)}}else{if(Qh(e))throw Error(Y(418));e.flags=e.flags&-4097|2,ft=!1,$n=e}}}function Vm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;$n=e}function qa(e){if(e!==$n)return!1;if(!ft)return Vm(e),ft=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Gh(e.type,e.memoizedProps)),t&&(t=Fn)){if(Qh(e))throw mb(),Error(Y(418));for(;t;)pb(e,t),t=_i(t.nextSibling)}if(Vm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Y(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Fn=_i(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Fn=null}}else Fn=$n?_i(e.stateNode.nextSibling):null;return!0}function mb(){for(var e=Fn;e;)e=_i(e.nextSibling)}function Gs(){Fn=$n=null,ft=!1}function Wf(e){hr===null?hr=[e]:hr.push(e)}var J1=Yr.ReactCurrentBatchConfig;function go(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Y(309));var r=n.stateNode}if(!r)throw Error(Y(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(Y(284));if(!n._owner)throw Error(Y(290,e))}return e}function Ka(e,t){throw e=Object.prototype.toString.call(t),Error(Y(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function qm(e){var t=e._init;return t(e._payload)}function gb(e){function t(_,v){if(e){var g=_.deletions;g===null?(_.deletions=[v],_.flags|=16):g.push(v)}}function n(_,v){if(!e)return null;for(;v!==null;)t(_,v),v=v.sibling;return null}function r(_,v){for(_=new Map;v!==null;)v.key!==null?_.set(v.key,v):_.set(v.index,v),v=v.sibling;return _}function i(_,v){return _=Si(_,v),_.index=0,_.sibling=null,_}function s(_,v,g){return _.index=g,e?(g=_.alternate,g!==null?(g=g.index,g<v?(_.flags|=2,v):g):(_.flags|=2,v)):(_.flags|=1048576,v)}function o(_){return e&&_.alternate===null&&(_.flags|=2),_}function a(_,v,g,S){return v===null||v.tag!==6?(v=Au(g,_.mode,S),v.return=_,v):(v=i(v,g),v.return=_,v)}function l(_,v,g,S){var k=g.type;return k===ks?d(_,v,g.props.children,S,g.key):v!==null&&(v.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ai&&qm(k)===v.type)?(S=i(v,g.props),S.ref=go(_,v,g),S.return=_,S):(S=Rl(g.type,g.key,g.props,null,_.mode,S),S.ref=go(_,v,g),S.return=_,S)}function c(_,v,g,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==g.containerInfo||v.stateNode.implementation!==g.implementation?(v=Iu(g,_.mode,S),v.return=_,v):(v=i(v,g.children||[]),v.return=_,v)}function d(_,v,g,S,k){return v===null||v.tag!==7?(v=Ji(g,_.mode,S,k),v.return=_,v):(v=i(v,g),v.return=_,v)}function h(_,v,g){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Au(""+v,_.mode,g),v.return=_,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ma:return g=Rl(v.type,v.key,v.props,null,_.mode,g),g.ref=go(_,null,v),g.return=_,g;case xs:return v=Iu(v,_.mode,g),v.return=_,v;case ai:var S=v._init;return h(_,S(v._payload),g)}if(To(v)||uo(v))return v=Ji(v,_.mode,g,null),v.return=_,v;Ka(_,v)}return null}function f(_,v,g,S){var k=v!==null?v.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return k!==null?null:a(_,v,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Ma:return g.key===k?l(_,v,g,S):null;case xs:return g.key===k?c(_,v,g,S):null;case ai:return k=g._init,f(_,v,k(g._payload),S)}if(To(g)||uo(g))return k!==null?null:d(_,v,g,S,null);Ka(_,g)}return null}function m(_,v,g,S,k){if(typeof S=="string"&&S!==""||typeof S=="number")return _=_.get(g)||null,a(v,_,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Ma:return _=_.get(S.key===null?g:S.key)||null,l(v,_,S,k);case xs:return _=_.get(S.key===null?g:S.key)||null,c(v,_,S,k);case ai:var x=S._init;return m(_,v,g,x(S._payload),k)}if(To(S)||uo(S))return _=_.get(g)||null,d(v,_,S,k,null);Ka(v,S)}return null}function p(_,v,g,S){for(var k=null,x=null,T=v,L=v=0,B=null;T!==null&&L<g.length;L++){T.index>L?(B=T,T=null):B=T.sibling;var j=f(_,T,g[L],S);if(j===null){T===null&&(T=B);break}e&&T&&j.alternate===null&&t(_,T),v=s(j,v,L),x===null?k=j:x.sibling=j,x=j,T=B}if(L===g.length)return n(_,T),ft&&Bi(_,L),k;if(T===null){for(;L<g.length;L++)T=h(_,g[L],S),T!==null&&(v=s(T,v,L),x===null?k=T:x.sibling=T,x=T);return ft&&Bi(_,L),k}for(T=r(_,T);L<g.length;L++)B=m(T,_,L,g[L],S),B!==null&&(e&&B.alternate!==null&&T.delete(B.key===null?L:B.key),v=s(B,v,L),x===null?k=B:x.sibling=B,x=B);return e&&T.forEach(function(F){return t(_,F)}),ft&&Bi(_,L),k}function y(_,v,g,S){var k=uo(g);if(typeof k!="function")throw Error(Y(150));if(g=k.call(g),g==null)throw Error(Y(151));for(var x=k=null,T=v,L=v=0,B=null,j=g.next();T!==null&&!j.done;L++,j=g.next()){T.index>L?(B=T,T=null):B=T.sibling;var F=f(_,T,j.value,S);if(F===null){T===null&&(T=B);break}e&&T&&F.alternate===null&&t(_,T),v=s(F,v,L),x===null?k=F:x.sibling=F,x=F,T=B}if(j.done)return n(_,T),ft&&Bi(_,L),k;if(T===null){for(;!j.done;L++,j=g.next())j=h(_,j.value,S),j!==null&&(v=s(j,v,L),x===null?k=j:x.sibling=j,x=j);return ft&&Bi(_,L),k}for(T=r(_,T);!j.done;L++,j=g.next())j=m(T,_,L,j.value,S),j!==null&&(e&&j.alternate!==null&&T.delete(j.key===null?L:j.key),v=s(j,v,L),x===null?k=j:x.sibling=j,x=j);return e&&T.forEach(function(A){return t(_,A)}),ft&&Bi(_,L),k}function b(_,v,g,S){if(typeof g=="object"&&g!==null&&g.type===ks&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Ma:e:{for(var k=g.key,x=v;x!==null;){if(x.key===k){if(k=g.type,k===ks){if(x.tag===7){n(_,x.sibling),v=i(x,g.props.children),v.return=_,_=v;break e}}else if(x.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ai&&qm(k)===x.type){n(_,x.sibling),v=i(x,g.props),v.ref=go(_,x,g),v.return=_,_=v;break e}n(_,x);break}else t(_,x);x=x.sibling}g.type===ks?(v=Ji(g.props.children,_.mode,S,g.key),v.return=_,_=v):(S=Rl(g.type,g.key,g.props,null,_.mode,S),S.ref=go(_,v,g),S.return=_,_=S)}return o(_);case xs:e:{for(x=g.key;v!==null;){if(v.key===x)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(_,v.sibling),v=i(v,g.children||[]),v.return=_,_=v;break e}else{n(_,v);break}else t(_,v);v=v.sibling}v=Iu(g,_.mode,S),v.return=_,_=v}return o(_);case ai:return x=g._init,b(_,v,x(g._payload),S)}if(To(g))return p(_,v,g,S);if(uo(g))return y(_,v,g,S);Ka(_,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(_,v.sibling),v=i(v,g),v.return=_,_=v):(n(_,v),v=Au(g,_.mode,S),v.return=_,_=v),o(_)):n(_,v)}return b}var Xs=gb(!0),yb=gb(!1),tc=ji(null),nc=null,Ps=null,Uf=null;function Vf(){Uf=Ps=nc=null}function qf(e){var t=tc.current;ht(tc),e._currentValue=t}function td(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Hs(e,t){nc=e,Uf=Ps=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(jn=!0),e.firstContext=null)}function rr(e){var t=e._currentValue;if(Uf!==e)if(e={context:e,memoizedValue:t,next:null},Ps===null){if(nc===null)throw Error(Y(308));Ps=e,nc.dependencies={lanes:0,firstContext:e}}else Ps=Ps.next=e;return t}var qi=null;function Kf(e){qi===null?qi=[e]:qi.push(e)}function _b(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Kf(t)):(n.next=i.next,i.next=n),t.interleaved=n,qr(e,r)}function qr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var li=!1;function Yf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vb(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Hr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,qr(e,n)}return i=r.interleaved,i===null?(t.next=t,Kf(r)):(t.next=i.next,i.next=t),r.interleaved=t,qr(e,n)}function xl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lf(e,n)}}function Km(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function rc(e,t,n,r){var i=e.updateQueue;li=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(s!==null){var h=i.baseState;o=0,d=c=l=null,a=s;do{var f=a.lane,m=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,y=a;switch(f=t,m=n,y.tag){case 1:if(p=y.payload,typeof p=="function"){h=p.call(m,h,f);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,f=typeof p=="function"?p.call(m,h,f):p,f==null)break e;h=wt({},h,f);break e;case 2:li=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=m,l=h):d=d.next=m,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(l=h),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);rs|=o,e.lanes=o,e.memoizedState=h}}function Ym(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(Y(191,i));i.call(r)}}}var Ca={},Rr=ji(Ca),ca=ji(Ca),ua=ji(Ca);function Ki(e){if(e===Ca)throw Error(Y(174));return e}function Gf(e,t){switch(ot(ua,t),ot(ca,e),ot(Rr,Ca),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ih(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ih(t,e)}ht(Rr),ot(Rr,t)}function Js(){ht(Rr),ht(ca),ht(ua)}function bb(e){Ki(ua.current);var t=Ki(Rr.current),n=Ih(t,e.type);t!==n&&(ot(ca,e),ot(Rr,n))}function Xf(e){ca.current===e&&(ht(Rr),ht(ca))}var vt=ji(0);function ic(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ju=[];function Jf(){for(var e=0;e<ju.length;e++)ju[e]._workInProgressVersionPrimary=null;ju.length=0}var kl=Yr.ReactCurrentDispatcher,Ru=Yr.ReactCurrentBatchConfig,ns=0,bt=null,Vt=null,Gt=null,sc=!1,Uo=!1,ha=0,Z1=0;function ln(){throw Error(Y(321))}function Zf(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gr(e[n],t[n]))return!1;return!0}function Qf(e,t,n,r,i,s){if(ns=s,bt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,kl.current=e===null||e.memoizedState===null?nk:rk,e=n(r,i),Uo){s=0;do{if(Uo=!1,ha=0,25<=s)throw Error(Y(301));s+=1,Gt=Vt=null,t.updateQueue=null,kl.current=ik,e=n(r,i)}while(Uo)}if(kl.current=oc,t=Vt!==null&&Vt.next!==null,ns=0,Gt=Vt=bt=null,sc=!1,t)throw Error(Y(300));return e}function ep(){var e=ha!==0;return ha=0,e}function Sr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?bt.memoizedState=Gt=e:Gt=Gt.next=e,Gt}function ir(){if(Vt===null){var e=bt.alternate;e=e!==null?e.memoizedState:null}else e=Vt.next;var t=Gt===null?bt.memoizedState:Gt.next;if(t!==null)Gt=t,Vt=e;else{if(e===null)throw Error(Y(310));Vt=e,e={memoizedState:Vt.memoizedState,baseState:Vt.baseState,baseQueue:Vt.baseQueue,queue:Vt.queue,next:null},Gt===null?bt.memoizedState=Gt=e:Gt=Gt.next=e}return Gt}function da(e,t){return typeof t=="function"?t(e):t}function Tu(e){var t=ir(),n=t.queue;if(n===null)throw Error(Y(311));n.lastRenderedReducer=e;var r=Vt,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,c=s;do{var d=c.lane;if((ns&d)===d)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var h={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,o=r):l=l.next=h,bt.lanes|=d,rs|=d}c=c.next}while(c!==null&&c!==s);l===null?o=r:l.next=a,gr(r,t.memoizedState)||(jn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,bt.lanes|=s,rs|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Du(e){var t=ir(),n=t.queue;if(n===null)throw Error(Y(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);gr(s,t.memoizedState)||(jn=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function wb(){}function Sb(e,t){var n=bt,r=ir(),i=t(),s=!gr(r.memoizedState,i);if(s&&(r.memoizedState=i,jn=!0),r=r.queue,tp(Cb.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Gt!==null&&Gt.memoizedState.tag&1){if(n.flags|=2048,fa(9,kb.bind(null,n,r,i,t),void 0,null),Qt===null)throw Error(Y(349));ns&30||xb(n,t,i)}return i}function xb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bt.updateQueue,t===null?(t={lastEffect:null,stores:null},bt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function kb(e,t,n,r){t.value=n,t.getSnapshot=r,Eb(t)&&Nb(e)}function Cb(e,t,n){return n(function(){Eb(t)&&Nb(e)})}function Eb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gr(e,n)}catch{return!0}}function Nb(e){var t=qr(e,1);t!==null&&fr(t,e,1,-1)}function Gm(e){var t=Sr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:e},t.queue=e,e=e.dispatch=tk.bind(null,bt,e),[t.memoizedState,e]}function fa(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bt.updateQueue,t===null?(t={lastEffect:null,stores:null},bt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function jb(){return ir().memoizedState}function Cl(e,t,n,r){var i=Sr();bt.flags|=e,i.memoizedState=fa(1|t,n,void 0,r===void 0?null:r)}function Ac(e,t,n,r){var i=ir();r=r===void 0?null:r;var s=void 0;if(Vt!==null){var o=Vt.memoizedState;if(s=o.destroy,r!==null&&Zf(r,o.deps)){i.memoizedState=fa(t,n,s,r);return}}bt.flags|=e,i.memoizedState=fa(1|t,n,s,r)}function Xm(e,t){return Cl(8390656,8,e,t)}function tp(e,t){return Ac(2048,8,e,t)}function Rb(e,t){return Ac(4,2,e,t)}function Tb(e,t){return Ac(4,4,e,t)}function Db(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pb(e,t,n){return n=n!=null?n.concat([e]):null,Ac(4,4,Db.bind(null,t,e),n)}function np(){}function Lb(e,t){var n=ir();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Zf(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ab(e,t){var n=ir();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Zf(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ib(e,t,n){return ns&21?(gr(n,t)||(n=Fv(),bt.lanes|=n,rs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,jn=!0),e.memoizedState=n)}function Q1(e,t){var n=Qe;Qe=n!==0&&4>n?n:4,e(!0);var r=Ru.transition;Ru.transition={};try{e(!1),t()}finally{Qe=n,Ru.transition=r}}function Mb(){return ir().memoizedState}function ek(e,t,n){var r=wi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ob(e))zb(t,n);else if(n=_b(e,t,n,r),n!==null){var i=bn();fr(n,e,r,i),Bb(n,t,r)}}function tk(e,t,n){var r=wi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ob(e))zb(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,gr(a,o)){var l=t.interleaved;l===null?(i.next=i,Kf(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=_b(e,t,i,r),n!==null&&(i=bn(),fr(n,e,r,i),Bb(n,t,r))}}function Ob(e){var t=e.alternate;return e===bt||t!==null&&t===bt}function zb(e,t){Uo=sc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bb(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Lf(e,n)}}var oc={readContext:rr,useCallback:ln,useContext:ln,useEffect:ln,useImperativeHandle:ln,useInsertionEffect:ln,useLayoutEffect:ln,useMemo:ln,useReducer:ln,useRef:ln,useState:ln,useDebugValue:ln,useDeferredValue:ln,useTransition:ln,useMutableSource:ln,useSyncExternalStore:ln,useId:ln,unstable_isNewReconciler:!1},nk={readContext:rr,useCallback:function(e,t){return Sr().memoizedState=[e,t===void 0?null:t],e},useContext:rr,useEffect:Xm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Cl(4194308,4,Db.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Cl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Cl(4,2,e,t)},useMemo:function(e,t){var n=Sr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Sr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ek.bind(null,bt,e),[r.memoizedState,e]},useRef:function(e){var t=Sr();return e={current:e},t.memoizedState=e},useState:Gm,useDebugValue:np,useDeferredValue:function(e){return Sr().memoizedState=e},useTransition:function(){var e=Gm(!1),t=e[0];return e=Q1.bind(null,e[1]),Sr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=bt,i=Sr();if(ft){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),Qt===null)throw Error(Y(349));ns&30||xb(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Xm(Cb.bind(null,r,s,e),[e]),r.flags|=2048,fa(9,kb.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Sr(),t=Qt.identifierPrefix;if(ft){var n=Fr,r=Br;n=(r&~(1<<32-dr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ha++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Z1++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},rk={readContext:rr,useCallback:Lb,useContext:rr,useEffect:tp,useImperativeHandle:Pb,useInsertionEffect:Rb,useLayoutEffect:Tb,useMemo:Ab,useReducer:Tu,useRef:jb,useState:function(){return Tu(da)},useDebugValue:np,useDeferredValue:function(e){var t=ir();return Ib(t,Vt.memoizedState,e)},useTransition:function(){var e=Tu(da)[0],t=ir().memoizedState;return[e,t]},useMutableSource:wb,useSyncExternalStore:Sb,useId:Mb,unstable_isNewReconciler:!1},ik={readContext:rr,useCallback:Lb,useContext:rr,useEffect:tp,useImperativeHandle:Pb,useInsertionEffect:Rb,useLayoutEffect:Tb,useMemo:Ab,useReducer:Du,useRef:jb,useState:function(){return Du(da)},useDebugValue:np,useDeferredValue:function(e){var t=ir();return Vt===null?t.memoizedState=e:Ib(t,Vt.memoizedState,e)},useTransition:function(){var e=Du(da)[0],t=ir().memoizedState;return[e,t]},useMutableSource:wb,useSyncExternalStore:Sb,useId:Mb,unstable_isNewReconciler:!1};function cr(e,t){if(e&&e.defaultProps){t=wt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function nd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:wt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ic={isMounted:function(e){return(e=e._reactInternals)?hs(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bn(),i=wi(e),s=Hr(r,i);s.payload=t,n!=null&&(s.callback=n),t=vi(e,s,i),t!==null&&(fr(t,e,i,r),xl(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bn(),i=wi(e),s=Hr(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=vi(e,s,i),t!==null&&(fr(t,e,i,r),xl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bn(),r=wi(e),i=Hr(n,r);i.tag=2,t!=null&&(i.callback=t),t=vi(e,i,r),t!==null&&(fr(t,e,r,n),xl(t,e,r))}};function Jm(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!sa(n,r)||!sa(i,s):!0}function Fb(e,t,n){var r=!1,i=Ci,s=t.contextType;return typeof s=="object"&&s!==null?s=rr(s):(i=Tn(t)?es:pn.current,r=t.contextTypes,s=(r=r!=null)?Ys(e,i):Ci),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ic,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Zm(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ic.enqueueReplaceState(t,t.state,null)}function rd(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Yf(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=rr(s):(s=Tn(t)?es:pn.current,i.context=Ys(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(nd(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Ic.enqueueReplaceState(i,i.state,null),rc(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Zs(e,t){try{var n="",r=t;do n+=P0(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
39
|
+
Error generating stack: `+s.message+`
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function Pu(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function id(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var sk=typeof WeakMap=="function"?WeakMap:Map;function $b(e,t,n){n=Hr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){lc||(lc=!0,pd=r),id(e,t)},n}function Hb(e,t,n){n=Hr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){id(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){id(e,t),typeof r!="function"&&(bi===null?bi=new Set([this]):bi.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Qm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new sk;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=vk.bind(null,e,t,n),t.then(e,e))}function eg(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function tg(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Hr(-1,1),t.tag=2,vi(n,t,1))),n.lanes|=1),e)}var ok=Yr.ReactCurrentOwner,jn=!1;function _n(e,t,n,r){t.child=e===null?yb(t,null,n,r):Xs(t,e.child,n,r)}function ng(e,t,n,r,i){n=n.render;var s=t.ref;return Hs(t,i),r=Qf(e,t,n,r,s,i),n=ep(),e!==null&&!jn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Kr(e,t,i)):(ft&&n&&$f(t),t.flags|=1,_n(e,t,r,i),t.child)}function rg(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!up(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Wb(e,t,s,r,i)):(e=Rl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:sa,n(o,r)&&e.ref===t.ref)return Kr(e,t,i)}return t.flags|=1,e=Si(s,r),e.ref=t.ref,e.return=t,t.child=e}function Wb(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(sa(s,r)&&e.ref===t.ref)if(jn=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(jn=!0);else return t.lanes=e.lanes,Kr(e,t,i)}return sd(e,t,n,r,i)}function Ub(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ot(As,Bn),Bn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ot(As,Bn),Bn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ot(As,Bn),Bn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,ot(As,Bn),Bn|=r;return _n(e,t,i,n),t.child}function Vb(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function sd(e,t,n,r,i){var s=Tn(n)?es:pn.current;return s=Ys(t,s),Hs(t,i),n=Qf(e,t,n,r,s,i),r=ep(),e!==null&&!jn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Kr(e,t,i)):(ft&&r&&$f(t),t.flags|=1,_n(e,t,n,i),t.child)}function ig(e,t,n,r,i){if(Tn(n)){var s=!0;Zl(t)}else s=!1;if(Hs(t,i),t.stateNode===null)El(e,t),Fb(t,n,r),rd(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=rr(c):(c=Tn(n)?es:pn.current,c=Ys(t,c));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&Zm(t,o,r,c),li=!1;var f=t.memoizedState;o.state=f,rc(t,r,o,i),l=t.memoizedState,a!==r||f!==l||Rn.current||li?(typeof d=="function"&&(nd(t,n,d,r),l=t.memoizedState),(a=li||Jm(t,n,a,r,f,l,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,vb(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:cr(t.type,a),o.props=c,h=t.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=rr(l):(l=Tn(n)?es:pn.current,l=Ys(t,l));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==l)&&Zm(t,o,r,l),li=!1,f=t.memoizedState,o.state=f,rc(t,r,o,i);var p=t.memoizedState;a!==h||f!==p||Rn.current||li?(typeof m=="function"&&(nd(t,n,m,r),p=t.memoizedState),(c=li||Jm(t,n,c,r,f,p,l)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),o.props=r,o.state=p,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return od(e,t,n,r,s,i)}function od(e,t,n,r,i,s){Vb(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&Wm(t,n,!1),Kr(e,t,s);r=t.stateNode,ok.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Xs(t,e.child,null,s),t.child=Xs(t,null,a,s)):_n(e,t,a,s),t.memoizedState=r.state,i&&Wm(t,n,!0),t.child}function qb(e){var t=e.stateNode;t.pendingContext?Hm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hm(e,t.context,!1),Gf(e,t.containerInfo)}function sg(e,t,n,r,i){return Gs(),Wf(i),t.flags|=256,_n(e,t,n,r),t.child}var ad={dehydrated:null,treeContext:null,retryLane:0};function ld(e){return{baseLanes:e,cachePool:null,transitions:null}}function Kb(e,t,n){var r=t.pendingProps,i=vt.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),ot(vt,i&1),e===null)return ed(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=zc(o,r,0,null),e=Ji(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=ld(n),t.memoizedState=ad,e):rp(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return ak(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Si(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Si(a,s):(s=Ji(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?ld(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=ad,r}return s=e.child,e=s.sibling,r=Si(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function rp(e,t){return t=zc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ya(e,t,n,r){return r!==null&&Wf(r),Xs(t,e.child,null,n),e=rp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ak(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=Pu(Error(Y(422))),Ya(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=zc({mode:"visible",children:r.children},i,0,null),s=Ji(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Xs(t,e.child,null,o),t.child.memoizedState=ld(o),t.memoizedState=ad,s);if(!(t.mode&1))return Ya(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Y(419)),r=Pu(s,r,void 0),Ya(e,t,o,r)}if(a=(o&e.childLanes)!==0,jn||a){if(r=Qt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,qr(e,i),fr(r,e,i,-1))}return cp(),r=Pu(Error(Y(421))),Ya(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=bk.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Fn=_i(i.nextSibling),$n=t,ft=!0,hr=null,e!==null&&(Jn[Zn++]=Br,Jn[Zn++]=Fr,Jn[Zn++]=ts,Br=e.id,Fr=e.overflow,ts=t),t=rp(t,r.children),t.flags|=4096,t)}function og(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),td(e.return,t,n)}function Lu(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Yb(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(_n(e,t,r.children,n),r=vt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&og(e,n,t);else if(e.tag===19)og(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ot(vt,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ic(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Lu(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ic(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Lu(t,!0,n,null,s);break;case"together":Lu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function El(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Kr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Y(153));if(t.child!==null){for(e=t.child,n=Si(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Si(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function lk(e,t,n){switch(t.tag){case 3:qb(t),Gs();break;case 5:bb(t);break;case 1:Tn(t.type)&&Zl(t);break;case 4:Gf(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;ot(tc,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ot(vt,vt.current&1),t.flags|=128,null):n&t.child.childLanes?Kb(e,t,n):(ot(vt,vt.current&1),e=Kr(e,t,n),e!==null?e.sibling:null);ot(vt,vt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Yb(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ot(vt,vt.current),r)break;return null;case 22:case 23:return t.lanes=0,Ub(e,t,n)}return Kr(e,t,n)}var Gb,cd,Xb,Jb;Gb=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};cd=function(){};Xb=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Ki(Rr.current);var s=null;switch(n){case"input":i=Dh(e,i),r=Dh(e,r),s=[];break;case"select":i=wt({},i,{value:void 0}),r=wt({},r,{value:void 0}),s=[];break;case"textarea":i=Ah(e,i),r=Ah(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Xl)}Mh(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Zo.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Zo.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&ct("scroll",e),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};Jb=function(e,t,n,r){n!==r&&(t.flags|=4)};function yo(e,t){if(!ft)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function cn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ck(e,t,n){var r=t.pendingProps;switch(Hf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(t),null;case 1:return Tn(t.type)&&Jl(),cn(t),null;case 3:return r=t.stateNode,Js(),ht(Rn),ht(pn),Jf(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(qa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,hr!==null&&(yd(hr),hr=null))),cd(e,t),cn(t),null;case 5:Xf(t);var i=Ki(ua.current);if(n=t.type,e!==null&&t.stateNode!=null)Xb(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Y(166));return cn(t),null}if(e=Ki(Rr.current),qa(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Er]=t,r[la]=s,e=(t.mode&1)!==0,n){case"dialog":ct("cancel",r),ct("close",r);break;case"iframe":case"object":case"embed":ct("load",r);break;case"video":case"audio":for(i=0;i<Po.length;i++)ct(Po[i],r);break;case"source":ct("error",r);break;case"img":case"image":case"link":ct("error",r),ct("load",r);break;case"details":ct("toggle",r);break;case"input":mm(r,s),ct("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},ct("invalid",r);break;case"textarea":ym(r,s),ct("invalid",r)}Mh(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Va(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Va(r.textContent,a,e),i=["children",""+a]):Zo.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ct("scroll",r)}switch(n){case"input":Oa(r),gm(r,s,!0);break;case"textarea":Oa(r),_m(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Xl)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Cv(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Er]=t,e[la]=r,Gb(e,t,!1,!1),t.stateNode=e;e:{switch(o=Oh(n,r),n){case"dialog":ct("cancel",e),ct("close",e),i=r;break;case"iframe":case"object":case"embed":ct("load",e),i=r;break;case"video":case"audio":for(i=0;i<Po.length;i++)ct(Po[i],e);i=r;break;case"source":ct("error",e),i=r;break;case"img":case"image":case"link":ct("error",e),ct("load",e),i=r;break;case"details":ct("toggle",e),i=r;break;case"input":mm(e,r),i=Dh(e,r),ct("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=wt({},r,{value:void 0}),ct("invalid",e);break;case"textarea":ym(e,r),i=Ah(e,r),ct("invalid",e);break;default:i=r}Mh(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?jv(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Ev(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Qo(e,l):typeof l=="number"&&Qo(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Zo.hasOwnProperty(s)?l!=null&&s==="onScroll"&&ct("scroll",e):l!=null&&Nf(e,s,l,o))}switch(n){case"input":Oa(e),gm(e,r,!1);break;case"textarea":Oa(e),_m(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ki(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?zs(e,!!r.multiple,s,!1):r.defaultValue!=null&&zs(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Xl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return cn(t),null;case 6:if(e&&t.stateNode!=null)Jb(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Y(166));if(n=Ki(ua.current),Ki(Rr.current),qa(t)){if(r=t.stateNode,n=t.memoizedProps,r[Er]=t,(s=r.nodeValue!==n)&&(e=$n,e!==null))switch(e.tag){case 3:Va(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Va(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Er]=t,t.stateNode=r}return cn(t),null;case 13:if(ht(vt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ft&&Fn!==null&&t.mode&1&&!(t.flags&128))mb(),Gs(),t.flags|=98560,s=!1;else if(s=qa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(Y(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Y(317));s[Er]=t}else Gs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;cn(t),s=!1}else hr!==null&&(yd(hr),hr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||vt.current&1?qt===0&&(qt=3):cp())),t.updateQueue!==null&&(t.flags|=4),cn(t),null);case 4:return Js(),cd(e,t),e===null&&oa(t.stateNode.containerInfo),cn(t),null;case 10:return qf(t.type._context),cn(t),null;case 17:return Tn(t.type)&&Jl(),cn(t),null;case 19:if(ht(vt),s=t.memoizedState,s===null)return cn(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)yo(s,!1);else{if(qt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ic(e),o!==null){for(t.flags|=128,yo(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ot(vt,vt.current&1|2),t.child}e=e.sibling}s.tail!==null&&At()>Qs&&(t.flags|=128,r=!0,yo(s,!1),t.lanes=4194304)}else{if(!r)if(e=ic(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),yo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ft)return cn(t),null}else 2*At()-s.renderingStartTime>Qs&&n!==1073741824&&(t.flags|=128,r=!0,yo(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=At(),t.sibling=null,n=vt.current,ot(vt,r?n&1|2:n&1),t):(cn(t),null);case 22:case 23:return lp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Bn&1073741824&&(cn(t),t.subtreeFlags&6&&(t.flags|=8192)):cn(t),null;case 24:return null;case 25:return null}throw Error(Y(156,t.tag))}function uk(e,t){switch(Hf(t),t.tag){case 1:return Tn(t.type)&&Jl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Js(),ht(Rn),ht(pn),Jf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xf(t),null;case 13:if(ht(vt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));Gs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ht(vt),null;case 4:return Js(),null;case 10:return qf(t.type._context),null;case 22:case 23:return lp(),null;case 24:return null;default:return null}}var Ga=!1,dn=!1,hk=typeof WeakSet=="function"?WeakSet:Set,me=null;function Ls(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jt(e,t,r)}else n.current=null}function ud(e,t,n){try{n()}catch(r){jt(e,t,r)}}var ag=!1;function dk(e,t){if(Kh=Kl,e=nb(),Ff(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var m;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===e)break t;if(f===n&&++c===i&&(a=o),f===s&&++d===r&&(l=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Yh={focusedElem:e,selectionRange:n},Kl=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,b=p.memoizedState,_=t.stateNode,v=_.getSnapshotBeforeUpdate(t.elementType===t.type?y:cr(t.type,y),b);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(S){jt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return p=ag,ag=!1,p}function Vo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&ud(t,n,s)}i=i.next}while(i!==r)}}function Mc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function hd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Zb(e){var t=e.alternate;t!==null&&(e.alternate=null,Zb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Er],delete t[la],delete t[Jh],delete t[Y1],delete t[G1])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qb(e){return e.tag===5||e.tag===3||e.tag===4}function lg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function dd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xl));else if(r!==4&&(e=e.child,e!==null))for(dd(e,t,n),e=e.sibling;e!==null;)dd(e,t,n),e=e.sibling}function fd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(fd(e,t,n),e=e.sibling;e!==null;)fd(e,t,n),e=e.sibling}var nn=null,ur=!1;function ei(e,t,n){for(n=n.child;n!==null;)ew(e,t,n),n=n.sibling}function ew(e,t,n){if(jr&&typeof jr.onCommitFiberUnmount=="function")try{jr.onCommitFiberUnmount(jc,n)}catch{}switch(n.tag){case 5:dn||Ls(n,t);case 6:var r=nn,i=ur;nn=null,ei(e,t,n),nn=r,ur=i,nn!==null&&(ur?(e=nn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):nn.removeChild(n.stateNode));break;case 18:nn!==null&&(ur?(e=nn,n=n.stateNode,e.nodeType===8?Eu(e.parentNode,n):e.nodeType===1&&Eu(e,n),ra(e)):Eu(nn,n.stateNode));break;case 4:r=nn,i=ur,nn=n.stateNode.containerInfo,ur=!0,ei(e,t,n),nn=r,ur=i;break;case 0:case 11:case 14:case 15:if(!dn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ud(n,t,o),i=i.next}while(i!==r)}ei(e,t,n);break;case 1:if(!dn&&(Ls(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){jt(n,t,a)}ei(e,t,n);break;case 21:ei(e,t,n);break;case 22:n.mode&1?(dn=(r=dn)||n.memoizedState!==null,ei(e,t,n),dn=r):ei(e,t,n);break;default:ei(e,t,n)}}function cg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new hk),t.forEach(function(r){var i=wk.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function or(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:nn=a.stateNode,ur=!1;break e;case 3:nn=a.stateNode.containerInfo,ur=!0;break e;case 4:nn=a.stateNode.containerInfo,ur=!0;break e}a=a.return}if(nn===null)throw Error(Y(160));ew(s,o,i),nn=null,ur=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){jt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)tw(t,e),t=t.sibling}function tw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(or(t,e),_r(e),r&4){try{Vo(3,e,e.return),Mc(3,e)}catch(y){jt(e,e.return,y)}try{Vo(5,e,e.return)}catch(y){jt(e,e.return,y)}}break;case 1:or(t,e),_r(e),r&512&&n!==null&&Ls(n,n.return);break;case 5:if(or(t,e),_r(e),r&512&&n!==null&&Ls(n,n.return),e.flags&32){var i=e.stateNode;try{Qo(i,"")}catch(y){jt(e,e.return,y)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&xv(i,s),Oh(a,o);var c=Oh(a,s);for(o=0;o<l.length;o+=2){var d=l[o],h=l[o+1];d==="style"?jv(i,h):d==="dangerouslySetInnerHTML"?Ev(i,h):d==="children"?Qo(i,h):Nf(i,d,h,c)}switch(a){case"input":Ph(i,s);break;case"textarea":kv(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var m=s.value;m!=null?zs(i,!!s.multiple,m,!1):f!==!!s.multiple&&(s.defaultValue!=null?zs(i,!!s.multiple,s.defaultValue,!0):zs(i,!!s.multiple,s.multiple?[]:"",!1))}i[la]=s}catch(y){jt(e,e.return,y)}}break;case 6:if(or(t,e),_r(e),r&4){if(e.stateNode===null)throw Error(Y(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(y){jt(e,e.return,y)}}break;case 3:if(or(t,e),_r(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ra(t.containerInfo)}catch(y){jt(e,e.return,y)}break;case 4:or(t,e),_r(e);break;case 13:or(t,e),_r(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(op=At())),r&4&&cg(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(dn=(c=dn)||d,or(t,e),dn=c):or(t,e),_r(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for(me=e,d=e.child;d!==null;){for(h=me=d;me!==null;){switch(f=me,m=f.child,f.tag){case 0:case 11:case 14:case 15:Vo(4,f,f.return);break;case 1:Ls(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(y){jt(r,n,y)}}break;case 5:Ls(f,f.return);break;case 22:if(f.memoizedState!==null){hg(h);continue}}m!==null?(m.return=f,me=m):hg(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Nv("display",o))}catch(y){jt(e,e.return,y)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(y){jt(e,e.return,y)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:or(t,e),_r(e),r&4&&cg(e);break;case 21:break;default:or(t,e),_r(e)}}function _r(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Qb(n)){var r=n;break e}n=n.return}throw Error(Y(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Qo(i,""),r.flags&=-33);var s=lg(e);fd(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=lg(e);dd(e,a,o);break;default:throw Error(Y(161))}}catch(l){jt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fk(e,t,n){me=e,nw(e)}function nw(e,t,n){for(var r=(e.mode&1)!==0;me!==null;){var i=me,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Ga;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||dn;a=Ga;var c=dn;if(Ga=o,(dn=l)&&!c)for(me=i;me!==null;)o=me,l=o.child,o.tag===22&&o.memoizedState!==null?dg(i):l!==null?(l.return=o,me=l):dg(i);for(;s!==null;)me=s,nw(s),s=s.sibling;me=i,Ga=a,dn=c}ug(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,me=s):ug(e)}}function ug(e){for(;me!==null;){var t=me;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:dn||Mc(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!dn)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:cr(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Ym(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Ym(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&ra(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Y(163))}dn||t.flags&512&&hd(t)}catch(f){jt(t,t.return,f)}}if(t===e){me=null;break}if(n=t.sibling,n!==null){n.return=t.return,me=n;break}me=t.return}}function hg(e){for(;me!==null;){var t=me;if(t===e){me=null;break}var n=t.sibling;if(n!==null){n.return=t.return,me=n;break}me=t.return}}function dg(e){for(;me!==null;){var t=me;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Mc(4,t)}catch(l){jt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){jt(t,i,l)}}var s=t.return;try{hd(t)}catch(l){jt(t,s,l)}break;case 5:var o=t.return;try{hd(t)}catch(l){jt(t,o,l)}}}catch(l){jt(t,t.return,l)}if(t===e){me=null;break}var a=t.sibling;if(a!==null){a.return=t.return,me=a;break}me=t.return}}var pk=Math.ceil,ac=Yr.ReactCurrentDispatcher,ip=Yr.ReactCurrentOwner,tr=Yr.ReactCurrentBatchConfig,Xe=0,Qt=null,Bt=null,on=0,Bn=0,As=ji(0),qt=0,pa=null,rs=0,Oc=0,sp=0,qo=null,Nn=null,op=0,Qs=1/0,Mr=null,lc=!1,pd=null,bi=null,Xa=!1,fi=null,cc=0,Ko=0,md=null,Nl=-1,jl=0;function bn(){return Xe&6?At():Nl!==-1?Nl:Nl=At()}function wi(e){return e.mode&1?Xe&2&&on!==0?on&-on:J1.transition!==null?(jl===0&&(jl=Fv()),jl):(e=Qe,e!==0||(e=window.event,e=e===void 0?16:Kv(e.type)),e):1}function fr(e,t,n,r){if(50<Ko)throw Ko=0,md=null,Error(Y(185));Sa(e,n,r),(!(Xe&2)||e!==Qt)&&(e===Qt&&(!(Xe&2)&&(Oc|=n),qt===4&&hi(e,on)),Dn(e,r),n===1&&Xe===0&&!(t.mode&1)&&(Qs=At()+500,Lc&&Ri()))}function Dn(e,t){var n=e.callbackNode;J0(e,t);var r=ql(e,e===Qt?on:0);if(r===0)n!==null&&wm(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&wm(n),t===1)e.tag===0?X1(fg.bind(null,e)):db(fg.bind(null,e)),q1(function(){!(Xe&6)&&Ri()}),n=null;else{switch($v(r)){case 1:n=Pf;break;case 4:n=zv;break;case 16:n=Vl;break;case 536870912:n=Bv;break;default:n=Vl}n=uw(n,rw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function rw(e,t){if(Nl=-1,jl=0,Xe&6)throw Error(Y(327));var n=e.callbackNode;if(Ws()&&e.callbackNode!==n)return null;var r=ql(e,e===Qt?on:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=uc(e,r);else{t=r;var i=Xe;Xe|=2;var s=sw();(Qt!==e||on!==t)&&(Mr=null,Qs=At()+500,Xi(e,t));do try{yk();break}catch(a){iw(e,a)}while(!0);Vf(),ac.current=s,Xe=i,Bt!==null?t=0:(Qt=null,on=0,t=qt)}if(t!==0){if(t===2&&(i=Hh(e),i!==0&&(r=i,t=gd(e,i))),t===1)throw n=pa,Xi(e,0),hi(e,r),Dn(e,At()),n;if(t===6)hi(e,r);else{if(i=e.current.alternate,!(r&30)&&!mk(i)&&(t=uc(e,r),t===2&&(s=Hh(e),s!==0&&(r=s,t=gd(e,s))),t===1))throw n=pa,Xi(e,0),hi(e,r),Dn(e,At()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(Y(345));case 2:Fi(e,Nn,Mr);break;case 3:if(hi(e,r),(r&130023424)===r&&(t=op+500-At(),10<t)){if(ql(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){bn(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Xh(Fi.bind(null,e,Nn,Mr),t);break}Fi(e,Nn,Mr);break;case 4:if(hi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-dr(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=At()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pk(r/1960))-r,10<r){e.timeoutHandle=Xh(Fi.bind(null,e,Nn,Mr),r);break}Fi(e,Nn,Mr);break;case 5:Fi(e,Nn,Mr);break;default:throw Error(Y(329))}}}return Dn(e,At()),e.callbackNode===n?rw.bind(null,e):null}function gd(e,t){var n=qo;return e.current.memoizedState.isDehydrated&&(Xi(e,t).flags|=256),e=uc(e,t),e!==2&&(t=Nn,Nn=n,t!==null&&yd(t)),e}function yd(e){Nn===null?Nn=e:Nn.push.apply(Nn,e)}function mk(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!gr(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function hi(e,t){for(t&=~sp,t&=~Oc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-dr(t),r=1<<n;e[n]=-1,t&=~r}}function fg(e){if(Xe&6)throw Error(Y(327));Ws();var t=ql(e,0);if(!(t&1))return Dn(e,At()),null;var n=uc(e,t);if(e.tag!==0&&n===2){var r=Hh(e);r!==0&&(t=r,n=gd(e,r))}if(n===1)throw n=pa,Xi(e,0),hi(e,t),Dn(e,At()),n;if(n===6)throw Error(Y(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fi(e,Nn,Mr),Dn(e,At()),null}function ap(e,t){var n=Xe;Xe|=1;try{return e(t)}finally{Xe=n,Xe===0&&(Qs=At()+500,Lc&&Ri())}}function is(e){fi!==null&&fi.tag===0&&!(Xe&6)&&Ws();var t=Xe;Xe|=1;var n=tr.transition,r=Qe;try{if(tr.transition=null,Qe=1,e)return e()}finally{Qe=r,tr.transition=n,Xe=t,!(Xe&6)&&Ri()}}function lp(){Bn=As.current,ht(As)}function Xi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,V1(n)),Bt!==null)for(n=Bt.return;n!==null;){var r=n;switch(Hf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Jl();break;case 3:Js(),ht(Rn),ht(pn),Jf();break;case 5:Xf(r);break;case 4:Js();break;case 13:ht(vt);break;case 19:ht(vt);break;case 10:qf(r.type._context);break;case 22:case 23:lp()}n=n.return}if(Qt=e,Bt=e=Si(e.current,null),on=Bn=t,qt=0,pa=null,sp=Oc=rs=0,Nn=qo=null,qi!==null){for(t=0;t<qi.length;t++)if(n=qi[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}qi=null}return e}function iw(e,t){do{var n=Bt;try{if(Vf(),kl.current=oc,sc){for(var r=bt.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}sc=!1}if(ns=0,Gt=Vt=bt=null,Uo=!1,ha=0,ip.current=null,n===null||n.return===null){qt=1,pa=t,Bt=null;break}e:{var s=e,o=n.return,a=n,l=t;if(t=on,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=eg(o);if(m!==null){m.flags&=-257,tg(m,o,a,s,t),m.mode&1&&Qm(s,c,t),t=m,l=c;var p=t.updateQueue;if(p===null){var y=new Set;y.add(l),t.updateQueue=y}else p.add(l);break e}else{if(!(t&1)){Qm(s,c,t),cp();break e}l=Error(Y(426))}}else if(ft&&a.mode&1){var b=eg(o);if(b!==null){!(b.flags&65536)&&(b.flags|=256),tg(b,o,a,s,t),Wf(Zs(l,a));break e}}s=l=Zs(l,a),qt!==4&&(qt=2),qo===null?qo=[s]:qo.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var _=$b(s,l,t);Km(s,_);break e;case 1:a=l;var v=s.type,g=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(bi===null||!bi.has(g)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=Hb(s,a,t);Km(s,S);break e}}s=s.return}while(s!==null)}aw(n)}catch(k){t=k,Bt===n&&n!==null&&(Bt=n=n.return);continue}break}while(!0)}function sw(){var e=ac.current;return ac.current=oc,e===null?oc:e}function cp(){(qt===0||qt===3||qt===2)&&(qt=4),Qt===null||!(rs&268435455)&&!(Oc&268435455)||hi(Qt,on)}function uc(e,t){var n=Xe;Xe|=2;var r=sw();(Qt!==e||on!==t)&&(Mr=null,Xi(e,t));do try{gk();break}catch(i){iw(e,i)}while(!0);if(Vf(),Xe=n,ac.current=r,Bt!==null)throw Error(Y(261));return Qt=null,on=0,qt}function gk(){for(;Bt!==null;)ow(Bt)}function yk(){for(;Bt!==null&&!H0();)ow(Bt)}function ow(e){var t=cw(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,t===null?aw(e):Bt=t,ip.current=null}function aw(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=uk(n,t),n!==null){n.flags&=32767,Bt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qt=6,Bt=null;return}}else if(n=ck(n,t,Bn),n!==null){Bt=n;return}if(t=t.sibling,t!==null){Bt=t;return}Bt=t=e}while(t!==null);qt===0&&(qt=5)}function Fi(e,t,n){var r=Qe,i=tr.transition;try{tr.transition=null,Qe=1,_k(e,t,n,r)}finally{tr.transition=i,Qe=r}return null}function _k(e,t,n,r){do Ws();while(fi!==null);if(Xe&6)throw Error(Y(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Y(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(Z0(e,s),e===Qt&&(Bt=Qt=null,on=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xa||(Xa=!0,uw(Vl,function(){return Ws(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=tr.transition,tr.transition=null;var o=Qe;Qe=1;var a=Xe;Xe|=4,ip.current=null,dk(e,n),tw(n,e),z1(Yh),Kl=!!Kh,Yh=Kh=null,e.current=n,fk(n),W0(),Xe=a,Qe=o,tr.transition=s}else e.current=n;if(Xa&&(Xa=!1,fi=e,cc=i),s=e.pendingLanes,s===0&&(bi=null),q0(n.stateNode),Dn(e,At()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(lc)throw lc=!1,e=pd,pd=null,e;return cc&1&&e.tag!==0&&Ws(),s=e.pendingLanes,s&1?e===md?Ko++:(Ko=0,md=e):Ko=0,Ri(),null}function Ws(){if(fi!==null){var e=$v(cc),t=tr.transition,n=Qe;try{if(tr.transition=null,Qe=16>e?16:e,fi===null)var r=!1;else{if(e=fi,fi=null,cc=0,Xe&6)throw Error(Y(331));var i=Xe;for(Xe|=4,me=e.current;me!==null;){var s=me,o=s.child;if(me.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(me=c;me!==null;){var d=me;switch(d.tag){case 0:case 11:case 15:Vo(8,d,s)}var h=d.child;if(h!==null)h.return=d,me=h;else for(;me!==null;){d=me;var f=d.sibling,m=d.return;if(Zb(d),d===c){me=null;break}if(f!==null){f.return=m,me=f;break}me=m}}}var p=s.alternate;if(p!==null){var y=p.child;if(y!==null){p.child=null;do{var b=y.sibling;y.sibling=null,y=b}while(y!==null)}}me=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,me=o;else e:for(;me!==null;){if(s=me,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Vo(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,me=_;break e}me=s.return}}var v=e.current;for(me=v;me!==null;){o=me;var g=o.child;if(o.subtreeFlags&2064&&g!==null)g.return=o,me=g;else e:for(o=v;me!==null;){if(a=me,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Mc(9,a)}}catch(k){jt(a,a.return,k)}if(a===o){me=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,me=S;break e}me=a.return}}if(Xe=i,Ri(),jr&&typeof jr.onPostCommitFiberRoot=="function")try{jr.onPostCommitFiberRoot(jc,e)}catch{}r=!0}return r}finally{Qe=n,tr.transition=t}}return!1}function pg(e,t,n){t=Zs(n,t),t=$b(e,t,1),e=vi(e,t,1),t=bn(),e!==null&&(Sa(e,1,t),Dn(e,t))}function jt(e,t,n){if(e.tag===3)pg(e,e,n);else for(;t!==null;){if(t.tag===3){pg(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(bi===null||!bi.has(r))){e=Zs(n,e),e=Hb(t,e,1),t=vi(t,e,1),e=bn(),t!==null&&(Sa(t,1,e),Dn(t,e));break}}t=t.return}}function vk(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=bn(),e.pingedLanes|=e.suspendedLanes&n,Qt===e&&(on&n)===n&&(qt===4||qt===3&&(on&130023424)===on&&500>At()-op?Xi(e,0):sp|=n),Dn(e,t)}function lw(e,t){t===0&&(e.mode&1?(t=Fa,Fa<<=1,!(Fa&130023424)&&(Fa=4194304)):t=1);var n=bn();e=qr(e,t),e!==null&&(Sa(e,t,n),Dn(e,n))}function bk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),lw(e,n)}function wk(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(t),lw(e,n)}var cw;cw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Rn.current)jn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return jn=!1,lk(e,t,n);jn=!!(e.flags&131072)}else jn=!1,ft&&t.flags&1048576&&fb(t,ec,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;El(e,t),e=t.pendingProps;var i=Ys(t,pn.current);Hs(t,n),i=Qf(null,t,r,e,i,n);var s=ep();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Tn(r)?(s=!0,Zl(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Yf(t),i.updater=Ic,t.stateNode=i,i._reactInternals=t,rd(t,r,e,n),t=od(null,t,r,!0,s,n)):(t.tag=0,ft&&s&&$f(t),_n(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(El(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=xk(r),e=cr(r,e),i){case 0:t=sd(null,t,r,e,n);break e;case 1:t=ig(null,t,r,e,n);break e;case 11:t=ng(null,t,r,e,n);break e;case 14:t=rg(null,t,r,cr(r.type,e),n);break e}throw Error(Y(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:cr(r,i),sd(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:cr(r,i),ig(e,t,r,i,n);case 3:e:{if(qb(t),e===null)throw Error(Y(387));r=t.pendingProps,s=t.memoizedState,i=s.element,vb(e,t),rc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Zs(Error(Y(423)),t),t=sg(e,t,r,n,i);break e}else if(r!==i){i=Zs(Error(Y(424)),t),t=sg(e,t,r,n,i);break e}else for(Fn=_i(t.stateNode.containerInfo.firstChild),$n=t,ft=!0,hr=null,n=yb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gs(),r===i){t=Kr(e,t,n);break e}_n(e,t,r,n)}t=t.child}return t;case 5:return bb(t),e===null&&ed(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Gh(r,i)?o=null:s!==null&&Gh(r,s)&&(t.flags|=32),Vb(e,t),_n(e,t,o,n),t.child;case 6:return e===null&&ed(t),null;case 13:return Kb(e,t,n);case 4:return Gf(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Xs(t,null,r,n):_n(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:cr(r,i),ng(e,t,r,i,n);case 7:return _n(e,t,t.pendingProps,n),t.child;case 8:return _n(e,t,t.pendingProps.children,n),t.child;case 12:return _n(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,ot(tc,r._currentValue),r._currentValue=o,s!==null)if(gr(s.value,o)){if(s.children===i.children&&!Rn.current){t=Kr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Hr(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),td(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Y(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),td(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}_n(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Hs(t,n),i=rr(i),r=r(i),t.flags|=1,_n(e,t,r,n),t.child;case 14:return r=t.type,i=cr(r,t.pendingProps),i=cr(r.type,i),rg(e,t,r,i,n);case 15:return Wb(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:cr(r,i),El(e,t),t.tag=1,Tn(r)?(e=!0,Zl(t)):e=!1,Hs(t,n),Fb(t,r,i),rd(t,r,i,n),od(null,t,r,!0,e,n);case 19:return Yb(e,t,n);case 22:return Ub(e,t,n)}throw Error(Y(156,t.tag))};function uw(e,t){return Ov(e,t)}function Sk(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function er(e,t,n,r){return new Sk(e,t,n,r)}function up(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xk(e){if(typeof e=="function")return up(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Rf)return 11;if(e===Tf)return 14}return 2}function Si(e,t){var n=e.alternate;return n===null?(n=er(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Rl(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")up(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ks:return Ji(n.children,i,s,t);case jf:o=8,i|=8;break;case Nh:return e=er(12,n,t,i|2),e.elementType=Nh,e.lanes=s,e;case jh:return e=er(13,n,t,i),e.elementType=jh,e.lanes=s,e;case Rh:return e=er(19,n,t,i),e.elementType=Rh,e.lanes=s,e;case bv:return zc(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _v:o=10;break e;case vv:o=9;break e;case Rf:o=11;break e;case Tf:o=14;break e;case ai:o=16,r=null;break e}throw Error(Y(130,e==null?e:typeof e,""))}return t=er(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Ji(e,t,n,r){return e=er(7,e,r,t),e.lanes=n,e}function zc(e,t,n,r){return e=er(22,e,r,t),e.elementType=bv,e.lanes=n,e.stateNode={isHidden:!1},e}function Au(e,t,n){return e=er(6,e,null,t),e.lanes=n,e}function Iu(e,t,n){return t=er(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function kk(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mu(0),this.expirationTimes=mu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mu(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function hp(e,t,n,r,i,s,o,a,l){return e=new kk(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=er(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yf(s),e}function Ck(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xs,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function hw(e){if(!e)return Ci;e=e._reactInternals;e:{if(hs(e)!==e||e.tag!==1)throw Error(Y(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Tn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Y(171))}if(e.tag===1){var n=e.type;if(Tn(n))return hb(e,n,t)}return t}function dw(e,t,n,r,i,s,o,a,l){return e=hp(n,r,!0,e,i,s,o,a,l),e.context=hw(null),n=e.current,r=bn(),i=wi(n),s=Hr(r,i),s.callback=t??null,vi(n,s,i),e.current.lanes=i,Sa(e,i,r),Dn(e,r),e}function Bc(e,t,n,r){var i=t.current,s=bn(),o=wi(i);return n=hw(n),t.context===null?t.context=n:t.pendingContext=n,t=Hr(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=vi(i,t,o),e!==null&&(fr(e,i,o,s),xl(e,i,o)),o}function hc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function dp(e,t){mg(e,t),(e=e.alternate)&&mg(e,t)}function Ek(){return null}var fw=typeof reportError=="function"?reportError:function(e){console.error(e)};function fp(e){this._internalRoot=e}Fc.prototype.render=fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Y(409));Bc(e,t,null,null)};Fc.prototype.unmount=fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;is(function(){Bc(null,e,null,null)}),t[Vr]=null}};function Fc(e){this._internalRoot=e}Fc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Uv();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ui.length&&t!==0&&t<ui[n].priority;n++);ui.splice(n,0,e),n===0&&qv(e)}};function pp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function $c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function gg(){}function Nk(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=hc(o);s.call(c)}}var o=dw(t,r,e,0,null,!1,!1,"",gg);return e._reactRootContainer=o,e[Vr]=o.current,oa(e.nodeType===8?e.parentNode:e),is(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=hc(l);a.call(c)}}var l=hp(e,0,!1,null,null,!1,!1,"",gg);return e._reactRootContainer=l,e[Vr]=l.current,oa(e.nodeType===8?e.parentNode:e),is(function(){Bc(t,l,n,r)}),l}function Hc(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=hc(o);a.call(l)}}Bc(t,o,e,i)}else o=Nk(n,t,e,i,r);return hc(o)}Hv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Do(t.pendingLanes);n!==0&&(Lf(t,n|1),Dn(t,At()),!(Xe&6)&&(Qs=At()+500,Ri()))}break;case 13:is(function(){var r=qr(e,1);if(r!==null){var i=bn();fr(r,e,1,i)}}),dp(e,1)}};Af=function(e){if(e.tag===13){var t=qr(e,134217728);if(t!==null){var n=bn();fr(t,e,134217728,n)}dp(e,134217728)}};Wv=function(e){if(e.tag===13){var t=wi(e),n=qr(e,t);if(n!==null){var r=bn();fr(n,e,t,r)}dp(e,t)}};Uv=function(){return Qe};Vv=function(e,t){var n=Qe;try{return Qe=e,t()}finally{Qe=n}};Bh=function(e,t,n){switch(t){case"input":if(Ph(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Pc(r);if(!i)throw Error(Y(90));Sv(r),Ph(r,i)}}}break;case"textarea":kv(e,n);break;case"select":t=n.value,t!=null&&zs(e,!!n.multiple,t,!1)}};Dv=ap;Pv=is;var jk={usingClientEntryPoint:!1,Events:[ka,js,Pc,Rv,Tv,ap]},_o={findFiberByHostInstance:Vi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Rk={bundleType:_o.bundleType,version:_o.version,rendererPackageName:_o.rendererPackageName,rendererConfig:_o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Yr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Iv(e),e===null?null:e.stateNode},findFiberByHostInstance:_o.findFiberByHostInstance||Ek,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ja=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ja.isDisabled&&Ja.supportsFiber)try{jc=Ja.inject(Rk),jr=Ja}catch{}}Un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jk;Un.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pp(t))throw Error(Y(200));return Ck(e,t,null,n)};Un.createRoot=function(e,t){if(!pp(e))throw Error(Y(299));var n=!1,r="",i=fw;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=hp(e,1,!1,null,null,n,!1,r,i),e[Vr]=t.current,oa(e.nodeType===8?e.parentNode:e),new fp(t)};Un.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Y(188)):(e=Object.keys(e).join(","),Error(Y(268,e)));return e=Iv(t),e=e===null?null:e.stateNode,e};Un.flushSync=function(e){return is(e)};Un.hydrate=function(e,t,n){if(!$c(t))throw Error(Y(200));return Hc(null,e,t,!0,n)};Un.hydrateRoot=function(e,t,n){if(!pp(e))throw Error(Y(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=fw;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=dw(t,null,e,1,n??null,i,!1,s,o),e[Vr]=t.current,oa(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Fc(t)};Un.render=function(e,t,n){if(!$c(t))throw Error(Y(200));return Hc(null,e,t,!1,n)};Un.unmountComponentAtNode=function(e){if(!$c(e))throw Error(Y(40));return e._reactRootContainer?(is(function(){Hc(null,null,e,!1,function(){e._reactRootContainer=null,e[Vr]=null})}),!0):!1};Un.unstable_batchedUpdates=ap;Un.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!$c(n))throw Error(Y(200));if(e==null||e._reactInternals===void 0)throw Error(Y(38));return Hc(e,t,n,!1,r)};Un.version="18.3.1-next-f1338f8080-20240426";function pw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pw)}catch(e){console.error(e)}}pw(),pv.exports=Un;var mw=pv.exports;const gw=ba(mw);var yg=mw;Ch.createRoot=yg.createRoot,Ch.hydrateRoot=yg.hydrateRoot;function Tk(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Dk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lk={};function _g(e,t){return(Lk.jsx?Pk:Dk).test(e)}const Ak=/[ \t\n\f\r]/g;function Ik(e){return typeof e=="object"?e.type==="text"?vg(e.value):!1:vg(e)}function vg(e){return e.replace(Ak,"")===""}class Ea{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ea.prototype.normal={};Ea.prototype.property={};Ea.prototype.space=void 0;function yw(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ea(n,r,t)}function _d(e){return e.toLowerCase()}class Pn{constructor(t,n){this.attribute=n,this.property=t}}Pn.prototype.attribute="";Pn.prototype.booleanish=!1;Pn.prototype.boolean=!1;Pn.prototype.commaOrSpaceSeparated=!1;Pn.prototype.commaSeparated=!1;Pn.prototype.defined=!1;Pn.prototype.mustUseProperty=!1;Pn.prototype.number=!1;Pn.prototype.overloadedBoolean=!1;Pn.prototype.property="";Pn.prototype.spaceSeparated=!1;Pn.prototype.space=void 0;let Mk=0;const Le=ds(),Mt=ds(),vd=ds(),J=ds(),st=ds(),Us=ds(),zn=ds();function ds(){return 2**++Mk}const bd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:Mt,commaOrSpaceSeparated:zn,commaSeparated:Us,number:J,overloadedBoolean:vd,spaceSeparated:st},Symbol.toStringTag,{value:"Module"})),Mu=Object.keys(bd);class mp extends Pn{constructor(t,n,r,i){let s=-1;if(super(t,n),bg(this,"space",i),typeof r=="number")for(;++s<Mu.length;){const o=Mu[s];bg(this,Mu[s],(r&bd[o])===bd[o])}}}mp.prototype.defined=!0;function bg(e,t,n){n&&(e[t]=n)}function so(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new mp(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[_d(r)]=r,n[_d(s.attribute)]=r}return new Ea(t,n,e.space)}const _w=so({properties:{ariaActiveDescendant:null,ariaAtomic:Mt,ariaAutoComplete:null,ariaBusy:Mt,ariaChecked:Mt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:st,ariaCurrent:null,ariaDescribedBy:st,ariaDetails:null,ariaDisabled:Mt,ariaDropEffect:st,ariaErrorMessage:null,ariaExpanded:Mt,ariaFlowTo:st,ariaGrabbed:Mt,ariaHasPopup:null,ariaHidden:Mt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:st,ariaLevel:J,ariaLive:null,ariaModal:Mt,ariaMultiLine:Mt,ariaMultiSelectable:Mt,ariaOrientation:null,ariaOwns:st,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:Mt,ariaReadOnly:Mt,ariaRelevant:null,ariaRequired:Mt,ariaRoleDescription:st,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:Mt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function vw(e,t){return t in e?e[t]:t}function bw(e,t){return vw(e,t.toLowerCase())}const Ok=so({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Us,acceptCharset:st,accessKey:st,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:st,autoFocus:Le,autoPlay:Le,blocking:st,capture:null,charSet:null,checked:Le,cite:null,className:st,cols:J,colSpan:null,content:null,contentEditable:Mt,controls:Le,controlsList:st,coords:J|Us,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:vd,draggable:Mt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:st,height:J,hidden:vd,high:J,href:null,hrefLang:null,htmlFor:st,httpEquiv:st,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:st,itemRef:st,itemScope:Le,itemType:st,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Le,optimum:J,pattern:null,ping:st,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:st,required:Le,reversed:Le,rows:J,rowSpan:J,sandbox:st,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:Mt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:Mt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:st,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:Mt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:bw}),zk=so({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zn,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:st,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Us,g2:Us,glyphName:Us,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:zn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:st,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zn,rev:zn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zn,requiredFeatures:zn,requiredFonts:zn,requiredFormats:zn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:zn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zn,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vw}),ww=so({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Sw=so({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bw}),xw=so({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Bk={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Fk=/[A-Z]/g,wg=/-[a-z]/g,$k=/^data[-\w.:]+$/i;function Hk(e,t){const n=_d(t);let r=t,i=Pn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$k.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(wg,Uk);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!wg.test(s)){let o=s.replace(Fk,Wk);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=mp}return new i(r,t)}function Wk(e){return"-"+e.toLowerCase()}function Uk(e){return e.charAt(1).toUpperCase()}const Vk=yw([_w,Ok,ww,Sw,xw],"html"),gp=yw([_w,zk,ww,Sw,xw],"svg");function qk(e){return e.join(" ").trim()}var yp={},Sg=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Kk=/\n/g,Yk=/^\s*/,Gk=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Xk=/^:\s*/,Jk=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Zk=/^[;\s]*/,Qk=/^\s+|\s+$/g,eC=`
|
|
41
|
+
`,xg="/",kg="*",Ui="",tC="comment",nC="declaration";function rC(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(p){var y=p.match(Kk);y&&(n+=y.length);var b=p.lastIndexOf(eC);r=~b?p.length-b:r+p.length}function s(){var p={line:n,column:r};return function(y){return y.position=new o(p),c(),y}}function o(p){this.start=p,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(p){var y=new Error(t.source+":"+n+":"+r+": "+p);if(y.reason=p,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(p){var y=p.exec(e);if(y){var b=y[0];return i(b),e=e.slice(b.length),y}}function c(){l(Yk)}function d(p){var y;for(p=p||[];y=h();)y!==!1&&p.push(y);return p}function h(){var p=s();if(!(xg!=e.charAt(0)||kg!=e.charAt(1))){for(var y=2;Ui!=e.charAt(y)&&(kg!=e.charAt(y)||xg!=e.charAt(y+1));)++y;if(y+=2,Ui===e.charAt(y-1))return a("End of comment missing");var b=e.slice(2,y-2);return r+=2,i(b),e=e.slice(y),r+=2,p({type:tC,comment:b})}}function f(){var p=s(),y=l(Gk);if(y){if(h(),!l(Xk))return a("property missing ':'");var b=l(Jk),_=p({type:nC,property:Cg(y[0].replace(Sg,Ui)),value:b?Cg(b[0].replace(Sg,Ui)):Ui});return l(Zk),_}}function m(){var p=[];d(p);for(var y;y=f();)y!==!1&&(p.push(y),d(p));return p}return c(),m()}function Cg(e){return e?e.replace(Qk,Ui):Ui}var iC=rC,sC=$l&&$l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yp,"__esModule",{value:!0});yp.default=aC;const oC=sC(iC);function aC(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,oC.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Wc={};Object.defineProperty(Wc,"__esModule",{value:!0});Wc.camelCase=void 0;var lC=/^--[a-zA-Z0-9_-]+$/,cC=/-([a-z])/g,uC=/^[^-]+$/,hC=/^-(webkit|moz|ms|o|khtml)-/,dC=/^-(ms)-/,fC=function(e){return!e||uC.test(e)||lC.test(e)},pC=function(e,t){return t.toUpperCase()},Eg=function(e,t){return"".concat(t,"-")},mC=function(e,t){return t===void 0&&(t={}),fC(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(dC,Eg):e=e.replace(hC,Eg),e.replace(cC,pC))};Wc.camelCase=mC;var gC=$l&&$l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},yC=gC(yp),_C=Wc;function wd(e,t){var n={};return!e||typeof e!="string"||(0,yC.default)(e,function(r,i){r&&i&&(n[(0,_C.camelCase)(r,t)]=i)}),n}wd.default=wd;var vC=wd;const bC=ba(vC),kw=Cw("end"),_p=Cw("start");function Cw(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function wC(e){const t=_p(e),n=kw(e);if(t&&n)return{start:t,end:n}}function Yo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ng(e.position):"start"in e||"end"in e?Ng(e):"line"in e||"column"in e?Sd(e):""}function Sd(e){return jg(e&&e.line)+":"+jg(e&&e.column)}function Ng(e){return Sd(e&&e.start)+"-"+Sd(e&&e.end)}function jg(e){return e&&typeof e=="number"?e:1}class mn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Yo(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mn.prototype.file="";mn.prototype.name="";mn.prototype.reason="";mn.prototype.message="";mn.prototype.stack="";mn.prototype.column=void 0;mn.prototype.line=void 0;mn.prototype.ancestors=void 0;mn.prototype.cause=void 0;mn.prototype.fatal=void 0;mn.prototype.place=void 0;mn.prototype.ruleId=void 0;mn.prototype.source=void 0;const vp={}.hasOwnProperty,SC=new Map,xC=/[A-Z]/g,kC=new Set(["table","tbody","thead","tfoot","tr"]),CC=new Set(["td","th"]),Ew="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function EC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=AC(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=LC(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?gp:Vk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Nw(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Nw(e,t,n){if(t.type==="element")return NC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return jC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return TC(e,t,n);if(t.type==="mdxjsEsm")return RC(e,t);if(t.type==="root")return DC(e,t,n);if(t.type==="text")return PC(e,t)}function NC(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=gp,e.schema=i),e.ancestors.push(t);const s=Rw(e,t.tagName,!1),o=IC(e,t);let a=wp(e,t);return kC.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Ik(l):!0})),jw(e,o,s,t),bp(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function jC(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ma(e,t.position)}function RC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ma(e,t.position)}function TC(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=gp,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Rw(e,t.name,!0),o=MC(e,t),a=wp(e,t);return jw(e,o,s,t),bp(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function DC(e,t,n){const r={};return bp(r,wp(e,t)),e.create(t,e.Fragment,r,n)}function PC(e,t){return t.value}function jw(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function bp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function LC(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function AC(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=_p(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function IC(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&vp.call(t.properties,i)){const s=OC(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&CC.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function MC(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ma(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else ma(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function wp(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:SC;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=Nw(e,s,o);a!==void 0&&n.push(a)}return n}function OC(e,t,n){const r=Hk(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Tk(n):qk(n)),r.property==="style"){let i=typeof n=="object"?n:zC(e,String(n));return e.stylePropertyNameCase==="css"&&(i=BC(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Bk[r.property]||r.property:r.attribute,n]}}function zC(e,t){try{return bC(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new mn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Ew+"#cannot-parse-style-attribute",i}}function Rw(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=_g(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=_g(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return vp.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ma(e)}function ma(e,t){const n=new mn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Ew+"#cannot-handle-mdx-estrees-without-createevaluater",n}function BC(e){const t={};let n;for(n in e)vp.call(e,n)&&(t[FC(n)]=e[n]);return t}function FC(e){let t=e.replace(xC,$C);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function $C(e){return"-"+e.toLowerCase()}const Ou={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},HC={};function Sp(e,t){const n=HC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Tw(e,r,i)}function Tw(e,t,n){if(WC(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Rg(e.children,t,n)}return Array.isArray(e)?Rg(e,t,n):""}function Rg(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Tw(e[i],t,n);return r.join("")}function WC(e){return!!(e&&typeof e=="object")}const Tg=document.createElement("i");function xp(e){const t="&"+e+";";Tg.innerHTML=t;const n=Tg.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Hn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function Qn(e,t){return e.length>0?(Hn(e,e.length,0,t),e):t}const Dg={}.hasOwnProperty;function Dw(e){const t={};let n=-1;for(;++n<e.length;)UC(t,e[n]);return t}function UC(e,t){let n;for(n in t){const i=(Dg.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){Dg.call(i,o)||(i[o]=[]);const a=s[o];VC(i[o],Array.isArray(a)?a:a?[a]:[])}}}function VC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Hn(e,0,0,r)}function Pw(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function pr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vn=Ti(/[A-Za-z]/),fn=Ti(/[\dA-Za-z]/),qC=Ti(/[#-'*+\--9=?A-Z^-~]/);function dc(e){return e!==null&&(e<32||e===127)}const xd=Ti(/\d/),KC=Ti(/[\dA-Fa-f]/),YC=Ti(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function nt(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const Uc=Ti(new RegExp("\\p{P}|\\p{S}","u")),ss=Ti(/\s/);function Ti(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function oo(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&fn(e.charCodeAt(n+1))&&fn(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ge(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return He(l)?(e.enter(n),a(l)):t(l)}function a(l){return He(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const GC={tokenize:XC};function XC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ge(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return xe(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const JC={tokenize:ZC},Pg={tokenize:QC};function ZC(e){const t=this,n=[];let r=0,i,s,o;return a;function a(g){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(g)}return c(g)}function l(g){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const S=t.events.length;let k=S,x;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){x=t.events[k][1].end;break}_(r);let T=S;for(;T<t.events.length;)t.events[T][1].end={...x},T++;return Hn(t.events,k+1,0,t.events.slice(S)),t.events.length=T,c(g)}return a(g)}function c(g){if(r===n.length){if(!i)return f(g);if(i.currentConstruct&&i.currentConstruct.concrete)return p(g);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Pg,d,h)(g)}function d(g){return i&&v(),_(r),f(g)}function h(g){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,p(g)}function f(g){return t.containerState={},e.attempt(Pg,m,p)(g)}function m(g){return r++,n.push([t.currentConstruct,t.containerState]),f(g)}function p(g){if(g===null){i&&v(),_(0),e.consume(g);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),y(g)}function y(g){if(g===null){b(e.exit("chunkFlow"),!0),_(0),e.consume(g);return}return xe(g)?(e.consume(g),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(g),y)}function b(g,S){const k=t.sliceStream(g);if(S&&k.push(null),g.previous=s,s&&(s.next=g),s=g,i.defineSkip(g.start),i.write(k),t.parser.lazy[g.start.line]){let x=i.events.length;for(;x--;)if(i.events[x][1].start.offset<o&&(!i.events[x][1].end||i.events[x][1].end.offset>o))return;const T=t.events.length;let L=T,B,j;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(B){j=t.events[L][1].end;break}B=!0}for(_(r),x=T;x<t.events.length;)t.events[x][1].end={...j},x++;Hn(t.events,L+1,0,t.events.slice(T)),t.events.length=x}}function _(g){let S=n.length;for(;S-- >g;){const k=n[S];t.containerState=k[1],k[0].exit.call(t,e)}n.length=g}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function QC(e,t,n){return Ge(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function eo(e){if(e===null||nt(e)||ss(e))return 1;if(Uc(e))return 2}function Vc(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const kd={name:"attention",resolveAll:eE,tokenize:tE};function eE(e,t){let n=-1,r,i,s,o,a,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},f={...e[n][1].start};Lg(h,-l),Lg(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Qn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Qn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=Qn(c,Vc(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Qn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Qn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Hn(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function tE(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=eo(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),d=eo(l),h=!d||d===2&&i||n.includes(l),f=!i||i===2&&d||n.includes(r);return c._open=!!(s===42?h:h&&(i||!f)),c._close=!!(s===42?f:f&&(d||!h)),t(l)}}function Lg(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const nE={name:"autolink",tokenize:rE};function rE(e,t,n){let r=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(m){return vn(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||fn(m)?(r=1,a(m)):c(m)}function a(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||fn(m))&&r++<32?(e.consume(m),a):(r=0,c(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||dc(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),d):qC(m)?(e.consume(m),c):n(m)}function d(m){return fn(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||fn(m))&&r++<63){const p=m===45?f:h;return e.consume(m),p}return n(m)}}const Na={partial:!0,tokenize:iE};function iE(e,t,n){return r;function r(s){return He(s)?Ge(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||xe(s)?t(s):n(s)}}const Lw={continuation:{tokenize:oE},exit:aE,name:"blockQuote",tokenize:sE};function sE(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return He(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function oE(e,t,n){const r=this;return i;function i(o){return He(o)?Ge(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Lw,t,n)(o)}}function aE(e){e.exit("blockQuote")}const Aw={name:"characterEscape",tokenize:lE};function lE(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return YC(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Iw={name:"characterReference",tokenize:cE};function cE(e,t,n){const r=this;let i=0,s,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=fn,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=KC,d):(e.enter("characterReferenceValue"),s=7,o=xd,d(h))}function d(h){if(h===59&&i){const f=e.exit("characterReferenceValue");return o===fn&&!xp(r.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&i++<s?(e.consume(h),d):n(h)}}const Ag={partial:!0,tokenize:hE},Ig={concrete:!0,name:"codeFenced",tokenize:uE};function uE(e,t,n){const r=this,i={partial:!0,tokenize:k};let s=0,o=0,a;return l;function l(x){return c(x)}function c(x){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(x)}function d(x){return x===a?(o++,e.consume(x),d):o<3?n(x):(e.exit("codeFencedFenceSequence"),He(x)?Ge(e,h,"whitespace")(x):h(x))}function h(x){return x===null||xe(x)?(e.exit("codeFencedFence"),r.interrupt?t(x):e.check(Ag,y,S)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===null||xe(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(x)):He(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ge(e,m,"whitespace")(x)):x===96&&x===a?n(x):(e.consume(x),f)}function m(x){return x===null||xe(x)?h(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||xe(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(x)):x===96&&x===a?n(x):(e.consume(x),p)}function y(x){return e.attempt(i,S,b)(x)}function b(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),_}function _(x){return s>0&&He(x)?Ge(e,v,"linePrefix",s+1)(x):v(x)}function v(x){return x===null||xe(x)?e.check(Ag,y,S)(x):(e.enter("codeFlowValue"),g(x))}function g(x){return x===null||xe(x)?(e.exit("codeFlowValue"),v(x)):(e.consume(x),g)}function S(x){return e.exit("codeFenced"),t(x)}function k(x,T,L){let B=0;return j;function j(N){return x.enter("lineEnding"),x.consume(N),x.exit("lineEnding"),F}function F(N){return x.enter("codeFencedFence"),He(N)?Ge(x,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):A(N)}function A(N){return N===a?(x.enter("codeFencedFenceSequence"),R(N)):L(N)}function R(N){return N===a?(B++,x.consume(N),R):B>=o?(x.exit("codeFencedFenceSequence"),He(N)?Ge(x,P,"whitespace")(N):P(N)):L(N)}function P(N){return N===null||xe(N)?(x.exit("codeFencedFence"),T(N)):L(N)}}}function hE(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const zu={name:"codeIndented",tokenize:fE},dE={partial:!0,tokenize:pE};function fE(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Ge(e,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):xe(c)?e.attempt(dE,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||xe(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function pE(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ge(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):xe(o)?i(o):n(o)}}const mE={name:"codeText",previous:yE,resolve:gE,tokenize:_E};function gE(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function yE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _E(e,t,n){let r=0,i,s;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),r++,a):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(s=e.enter("codeTextSequence"),i=0,d(h)):xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||xe(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",c(h))}}class vE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&vo(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),vo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);vo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);vo(this.left,n.reverse())}}}function vo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Mw(e){const t={};let n=-1,r,i,s,o,a,l,c;const d=new vE(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,bE(d,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},a=d.slice(i,n),a.unshift(r),d.splice(i,n-i+1,a))}}return Hn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function bE(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let d,h,f=-1,m=n,p=0,y=0;const b=[y];for(;m;){for(;e.get(++i)[1]!==m;);s.push(i),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(y=f+1,b.push(y),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),f=b.length;f--;){const _=a.slice(b[f],b[f+1]),v=s.pop();l.push([v,v+_.length-1]),e.splice(v,2,_)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const wE={resolve:xE,tokenize:kE},SE={partial:!0,tokenize:CE};function xE(e){return Mw(e),e}function kE(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):xe(a)?e.check(SE,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function CE(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ge(e,s,"linePrefix")}function s(o){if(o===null||xe(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Ow(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(_){return _===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(_),e.exit(s),f):_===null||_===32||_===41||dc(_)?n(_):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(_))}function f(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===62?(e.exit("chunkString"),e.exit(a),f(_)):_===null||_===60||xe(_)?n(_):(e.consume(_),_===92?p:m)}function p(_){return _===60||_===62||_===92?(e.consume(_),m):m(_)}function y(_){return!d&&(_===null||_===41||nt(_))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(_)):d<c&&_===40?(e.consume(_),d++,y):_===41?(e.consume(_),d--,y):_===null||_===32||_===40||dc(_)?n(_):(e.consume(_),_===92?b:y)}function b(_){return _===40||_===41||_===92?(e.consume(_),y):y(_)}}function zw(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(m){return e.enter(r),e.enter(i),e.consume(m),e.exit(i),e.enter(s),d}function d(m){return a>999||m===null||m===91||m===93&&!l||m===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(s),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||xe(m)||a++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!He(m)),m===92?f:h)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,h):h(m)}}function Bw(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),l(o)):f===null?n(f):xe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ge(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||xe(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function Go(e,t){let n;return r;function r(i){return xe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):He(i)?Ge(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const EE={name:"definition",tokenize:jE},NE={partial:!0,tokenize:RE};function jE(e,t,n){const r=this;let i;return s;function s(m){return e.enter("definition"),o(m)}function o(m){return zw.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return i=pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return nt(m)?Go(e,c)(m):c(m)}function c(m){return Ow(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(NE,h,h)(m)}function h(m){return He(m)?Ge(e,f,"whitespace")(m):f(m)}function f(m){return m===null||xe(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function RE(e,t,n){return r;function r(a){return nt(a)?Go(e,i)(a):n(a)}function i(a){return Bw(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return He(a)?Ge(e,o,"whitespace")(a):o(a)}function o(a){return a===null||xe(a)?t(a):n(a)}}const TE={name:"hardBreakEscape",tokenize:DE};function DE(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return xe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const PE={name:"headingAtx",resolve:LE,tokenize:AE};function LE(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Hn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function AE(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||nt(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):He(d)?Ge(e,a,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||nt(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),c)}}const IE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Mg=["pre","script","style","textarea"],ME={concrete:!0,name:"htmlFlow",resolveTo:BE,tokenize:FE},OE={partial:!0,tokenize:HE},zE={partial:!0,tokenize:$E};function BE(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function FE(e,t,n){const r=this;let i,s,o,a,l;return c;function c(E){return d(E)}function d(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),h}function h(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),s=!0,y):E===63?(e.consume(E),i=3,r.interrupt?t:C):vn(E)?(e.consume(E),o=String.fromCharCode(E),b):n(E)}function f(E){return E===45?(e.consume(E),i=2,m):E===91?(e.consume(E),i=5,a=0,p):vn(E)?(e.consume(E),i=4,r.interrupt?t:C):n(E)}function m(E){return E===45?(e.consume(E),r.interrupt?t:C):n(E)}function p(E){const ue="CDATA[";return E===ue.charCodeAt(a++)?(e.consume(E),a===ue.length?r.interrupt?t:A:p):n(E)}function y(E){return vn(E)?(e.consume(E),o=String.fromCharCode(E),b):n(E)}function b(E){if(E===null||E===47||E===62||nt(E)){const ue=E===47,ve=o.toLowerCase();return!ue&&!s&&Mg.includes(ve)?(i=1,r.interrupt?t(E):A(E)):IE.includes(o.toLowerCase())?(i=6,ue?(e.consume(E),_):r.interrupt?t(E):A(E)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):s?v(E):g(E))}return E===45||fn(E)?(e.consume(E),o+=String.fromCharCode(E),b):n(E)}function _(E){return E===62?(e.consume(E),r.interrupt?t:A):n(E)}function v(E){return He(E)?(e.consume(E),v):j(E)}function g(E){return E===47?(e.consume(E),j):E===58||E===95||vn(E)?(e.consume(E),S):He(E)?(e.consume(E),g):j(E)}function S(E){return E===45||E===46||E===58||E===95||fn(E)?(e.consume(E),S):k(E)}function k(E){return E===61?(e.consume(E),x):He(E)?(e.consume(E),k):g(E)}function x(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,T):He(E)?(e.consume(E),x):L(E)}function T(E){return E===l?(e.consume(E),l=null,B):E===null||xe(E)?n(E):(e.consume(E),T)}function L(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||nt(E)?k(E):(e.consume(E),L)}function B(E){return E===47||E===62||He(E)?g(E):n(E)}function j(E){return E===62?(e.consume(E),F):n(E)}function F(E){return E===null||xe(E)?A(E):He(E)?(e.consume(E),F):n(E)}function A(E){return E===45&&i===2?(e.consume(E),O):E===60&&i===1?(e.consume(E),W):E===62&&i===4?(e.consume(E),X):E===63&&i===3?(e.consume(E),C):E===93&&i===5?(e.consume(E),I):xe(E)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(OE,ie,R)(E)):E===null||xe(E)?(e.exit("htmlFlowData"),R(E)):(e.consume(E),A)}function R(E){return e.check(zE,P,ie)(E)}function P(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),N}function N(E){return E===null||xe(E)?R(E):(e.enter("htmlFlowData"),A(E))}function O(E){return E===45?(e.consume(E),C):A(E)}function W(E){return E===47?(e.consume(E),o="",D):A(E)}function D(E){if(E===62){const ue=o.toLowerCase();return Mg.includes(ue)?(e.consume(E),X):A(E)}return vn(E)&&o.length<8?(e.consume(E),o+=String.fromCharCode(E),D):A(E)}function I(E){return E===93?(e.consume(E),C):A(E)}function C(E){return E===62?(e.consume(E),X):E===45&&i===2?(e.consume(E),C):A(E)}function X(E){return E===null||xe(E)?(e.exit("htmlFlowData"),ie(E)):(e.consume(E),X)}function ie(E){return e.exit("htmlFlow"),t(E)}}function $E(e,t,n){const r=this;return i;function i(o){return xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function HE(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Na,t,n)}}const WE={name:"htmlText",tokenize:UE};function UE(e,t,n){const r=this;let i,s,o;return a;function a(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),c):C===47?(e.consume(C),k):C===63?(e.consume(C),g):vn(C)?(e.consume(C),L):n(C)}function c(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),s=0,p):vn(C)?(e.consume(C),v):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),f):xe(C)?(o=h,W(C)):(e.consume(C),h)}function f(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?O(C):C===45?f(C):h(C)}function p(C){const X="CDATA[";return C===X.charCodeAt(s++)?(e.consume(C),s===X.length?y:p):n(C)}function y(C){return C===null?n(C):C===93?(e.consume(C),b):xe(C)?(o=y,W(C)):(e.consume(C),y)}function b(C){return C===93?(e.consume(C),_):y(C)}function _(C){return C===62?O(C):C===93?(e.consume(C),_):y(C)}function v(C){return C===null||C===62?O(C):xe(C)?(o=v,W(C)):(e.consume(C),v)}function g(C){return C===null?n(C):C===63?(e.consume(C),S):xe(C)?(o=g,W(C)):(e.consume(C),g)}function S(C){return C===62?O(C):g(C)}function k(C){return vn(C)?(e.consume(C),x):n(C)}function x(C){return C===45||fn(C)?(e.consume(C),x):T(C)}function T(C){return xe(C)?(o=T,W(C)):He(C)?(e.consume(C),T):O(C)}function L(C){return C===45||fn(C)?(e.consume(C),L):C===47||C===62||nt(C)?B(C):n(C)}function B(C){return C===47?(e.consume(C),O):C===58||C===95||vn(C)?(e.consume(C),j):xe(C)?(o=B,W(C)):He(C)?(e.consume(C),B):O(C)}function j(C){return C===45||C===46||C===58||C===95||fn(C)?(e.consume(C),j):F(C)}function F(C){return C===61?(e.consume(C),A):xe(C)?(o=F,W(C)):He(C)?(e.consume(C),F):B(C)}function A(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,R):xe(C)?(o=A,W(C)):He(C)?(e.consume(C),A):(e.consume(C),P)}function R(C){return C===i?(e.consume(C),i=void 0,N):C===null?n(C):xe(C)?(o=R,W(C)):(e.consume(C),R)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||nt(C)?B(C):(e.consume(C),P)}function N(C){return C===47||C===62||nt(C)?B(C):n(C)}function O(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function W(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),D}function D(C){return He(C)?Ge(e,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):I(C)}function I(C){return e.enter("htmlTextData"),o(C)}}const kp={name:"labelEnd",resolveAll:YE,resolveTo:GE,tokenize:XE},VE={tokenize:JE},qE={tokenize:ZE},KE={tokenize:QE};function YE(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Hn(e,0,e.length,n),e}function GE(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Qn(a,e.slice(s+1,s+r+3)),a=Qn(a,[["enter",d,t]]),a=Qn(a,Vc(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=Qn(a,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),a=Qn(a,e.slice(o+1)),a=Qn(a,[["exit",l,t]]),Hn(e,s,e.length,a),e}function XE(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?h(f):(o=r.parser.defined.includes(pr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(VE,d,o?d:h)(f):f===91?e.attempt(qE,d,o?c:h)(f):o?d(f):h(f)}function c(f){return e.attempt(KE,d,h)(f)}function d(f){return t(f)}function h(f){return s._balanced=!0,n(f)}}function JE(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return nt(h)?Go(e,s)(h):s(h)}function s(h){return h===41?d(h):Ow(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return nt(h)?Go(e,l)(h):d(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?Bw(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return nt(h)?Go(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function ZE(e,t,n){const r=this;return i;function i(a){return zw.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function QE(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const eN={name:"labelStartImage",resolveAll:kp.resolveAll,tokenize:tN};function tN(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const nN={name:"labelStartLink",resolveAll:kp.resolveAll,tokenize:rN};function rN(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Bu={name:"lineEnding",tokenize:iN};function iN(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ge(e,t,"linePrefix")}}const Tl={name:"thematicBreak",tokenize:sN};function sN(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||xe(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),He(c)?Ge(e,a,"whitespace")(c):a(c))}}const En={continuation:{tokenize:cN},exit:hN,name:"list",tokenize:lN},oN={partial:!0,tokenize:dN},aN={partial:!0,tokenize:uN};function lN(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:xd(m)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Tl,n,c)(m):c(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return xd(m)&&++o<10?(e.consume(m),l):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(Na,r.interrupt?n:d,e.attempt(oN,f,h))}function d(m){return r.containerState.initialBlankLine=!0,s++,f(m)}function h(m){return He(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function cN(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Na,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ge(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!He(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(aN,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ge(e,e.attempt(En,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function uN(e,t,n){const r=this;return Ge(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function hN(e){e.exit(this.containerState.type)}function dN(e,t,n){const r=this;return Ge(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!He(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Og={name:"setextUnderline",resolveTo:fN,tokenize:pN};function fN(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function pN(e,t,n){const r=this;let i;return s;function s(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),He(c)?Ge(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||xe(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const mN={tokenize:gN};function gN(e){const t=this,n=e.attempt(Na,r,e.attempt(this.parser.constructs.flowInitial,i,Ge(e,e.attempt(this.parser.constructs.flow,i,e.attempt(wE,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yN={resolveAll:$w()},_N=Fw("string"),vN=Fw("text");function Fw(e){return{resolveAll:$w(e==="text"?bN:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(d){return c(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=i[d];let f=-1;if(h)for(;++f<h.length;){const m=h[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function $w(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function bN(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const wN={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:Lw},SN={91:EE},xN={[-2]:zu,[-1]:zu,32:zu},kN={35:PE,42:Tl,45:[Og,Tl],60:ME,61:Og,95:Tl,96:Ig,126:Ig},CN={38:Iw,92:Aw},EN={[-5]:Bu,[-4]:Bu,[-3]:Bu,33:eN,38:Iw,42:kd,60:[nE,WE],91:nN,92:[TE,Aw],93:kp,95:kd,96:mE},NN={null:[kd,yN]},jN={null:[42,95]},RN={null:[]},TN=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jN,contentInitial:SN,disable:RN,document:wN,flow:kN,flowInitial:xN,insideSpan:NN,string:CN,text:EN},Symbol.toStringTag,{value:"Module"}));function DN(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(k),check:T(x),consume:v,enter:g,exit:S,interrupt:T(x,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:h};let d=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function h(F){return o=Qn(o,F),b(),o[o.length-1]!==null?[]:(L(t,0),c.events=Vc(s,c.events,c),c.events)}function f(F,A){return LN(m(F),A)}function m(F){return PN(o,F)}function p(){const{_bufferIndex:F,_index:A,line:R,column:P,offset:N}=r;return{_bufferIndex:F,_index:A,line:R,column:P,offset:N}}function y(F){i[F.line]=F.column,j()}function b(){let F;for(;r._index<o.length;){const A=o[r._index];if(typeof A=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<A.length;)_(A.charCodeAt(r._bufferIndex));else _(A)}}function _(F){d=d(F)}function v(F){xe(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,j()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function g(F,A){const R=A||{};return R.type=F,R.start=p(),c.events.push(["enter",R,c]),a.push(R),R}function S(F){const A=a.pop();return A.end=p(),c.events.push(["exit",A,c]),A}function k(F,A){L(F,A.from)}function x(F,A){A.restore()}function T(F,A){return R;function R(P,N,O){let W,D,I,C;return Array.isArray(P)?ie(P):"tokenize"in P?ie([P]):X(P);function X(Z){return pe;function pe(ce){const ge=ce!==null&&Z[ce],Pe=ce!==null&&Z.null,we=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return ie(we)(ce)}}function ie(Z){return W=Z,D=0,Z.length===0?O:E(Z[D])}function E(Z){return pe;function pe(ce){return C=B(),I=Z,Z.partial||(c.currentConstruct=Z),Z.name&&c.parser.constructs.disable.null.includes(Z.name)?ve():Z.tokenize.call(A?Object.assign(Object.create(c),A):c,l,ue,ve)(ce)}}function ue(Z){return F(I,C),N}function ve(Z){return C.restore(),++D<W.length?E(W[D]):O}}}function L(F,A){F.resolveAll&&!s.includes(F)&&s.push(F),F.resolve&&Hn(c.events,A,c.events.length-A,F.resolve(c.events.slice(A),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function B(){const F=p(),A=c.previous,R=c.currentConstruct,P=c.events.length,N=Array.from(a);return{from:P,restore:O};function O(){r=F,c.previous=A,c.currentConstruct=R,c.events.length=P,a=N,j()}}function j(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function PN(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function LN(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
42
|
+
`;break}case-3:{o=`\r
|
|
43
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function AN(e){const r={constructs:Dw([TN,...(e||{}).extensions||[]]),content:i(GC),defined:[],document:i(JC),flow:i(mN),lazy:{},string:i(_N),text:i(vN)};return r;function i(s){return o;function o(a){return DN(r,s,a)}}}function IN(e){for(;!Mw(e););return e}const zg=/[\0\t\n\r]/g;function MN(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,d,h,f,m;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,t="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(zg.lastIndex=h,c=zg.exec(s),f=c&&c.index!==void 0?c.index:s.length,m=s.charCodeAt(f),!c){t=s.slice(h);break}if(m===10&&h===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<f&&(l.push(s.slice(h,f)),e+=f-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const ON=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zN(e){return e.replace(ON,BN)}function BN(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Pw(n.slice(s?2:1),s?16:10)}return xp(n)||e}const Hw={}.hasOwnProperty;function FN(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),$N(n)(IN(AN(n).document().write(MN()(e,t,!0))))}function $N(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(G),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(M),blockQuote:s(Pe),characterEscape:B,characterReference:B,codeFenced:s(we),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(we,o),codeText:s(Be,o),codeTextData:B,data:B,codeFlowValue:B,definition:s(be),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ue),hardBreakEscape:s(ae),hardBreakTrailing:s(ae),htmlFlow:s(re,o),htmlFlowData:B,htmlText:s(re,o),htmlTextData:B,image:s(Ee),label:o,link:s(G),listItem:s(ke),listItemValue:f,listOrdered:s(se,h),listUnordered:s(se),paragraph:s($e),reference:E,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(M),strong:s(Ve),thematicBreak:s(mt)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:ge,autolinkProtocol:ce,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:Z,characterReference:pe,codeFenced:l(b),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:j,codeIndented:l(_),codeText:l(N),codeTextData:j,data:j,definition:l(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:g,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(R),htmlFlowData:j,htmlText:l(P),htmlTextData:j,image:l(W),label:I,labelText:D,lineEnding:F,link:l(O),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ue,resourceDestinationString:C,resourceTitleString:X,resource:ie,setextHeading:l(L),setextHeadingLineSequence:T,setextHeadingText:x,strong:l(),thematicBreak:l()}};Ww(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(z){let q={type:"root",children:[]};const _e={stack:[q],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:d,data:n},Q=[];let Re=-1;for(;++Re<z.length;)if(z[Re][1].type==="listOrdered"||z[Re][1].type==="listUnordered")if(z[Re][0]==="enter")Q.push(Re);else{const rt=Q.pop();Re=i(z,rt,Re)}for(Re=-1;++Re<z.length;){const rt=t[z[Re][0]];Hw.call(rt,z[Re][1].type)&&rt[z[Re][1].type].call(Object.assign({sliceSerialize:z[Re][2].sliceSerialize},_e),z[Re][1])}if(_e.tokenStack.length>0){const rt=_e.tokenStack[_e.tokenStack.length-1];(rt[1]||Bg).call(_e,void 0,rt[0])}for(q.position={start:ti(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:ti(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},Re=-1;++Re<t.transforms.length;)q=t.transforms[Re](q)||q;return q}function i(z,q,_e){let Q=q-1,Re=-1,rt=!1,at,Tt,tn,Ft;for(;++Q<=_e;){const xt=z[Q];switch(xt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xt[0]==="enter"?Re++:Re--,Ft=void 0;break}case"lineEndingBlank":{xt[0]==="enter"&&(at&&!Ft&&!Re&&!tn&&(tn=Q),Ft=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ft=void 0}if(!Re&&xt[0]==="enter"&&xt[1].type==="listItemPrefix"||Re===-1&&xt[0]==="exit"&&(xt[1].type==="listUnordered"||xt[1].type==="listOrdered")){if(at){let lt=Q;for(Tt=void 0;lt--;){const It=z[lt];if(It[1].type==="lineEnding"||It[1].type==="lineEndingBlank"){if(It[0]==="exit")continue;Tt&&(z[Tt][1].type="lineEndingBlank",rt=!0),It[1].type="lineEnding",Tt=lt}else if(!(It[1].type==="linePrefix"||It[1].type==="blockQuotePrefix"||It[1].type==="blockQuotePrefixWhitespace"||It[1].type==="blockQuoteMarker"||It[1].type==="listItemIndent"))break}tn&&(!Tt||tn<Tt)&&(at._spread=!0),at.end=Object.assign({},Tt?z[Tt][1].start:xt[1].end),z.splice(Tt||Q,0,["exit",at,xt[2]]),Q++,_e++}if(xt[1].type==="listItemPrefix"){const lt={type:"listItem",_spread:!1,start:Object.assign({},xt[1].start),end:void 0};at=lt,z.splice(Q,0,["enter",lt,xt[2]]),Q++,_e++,tn=void 0,Ft=!0}}}return z[q][1]._spread=rt,_e}function s(z,q){return _e;function _e(Q){a.call(this,z(Q),Q),q&&q.call(this,Q)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(z,q,_e){this.stack[this.stack.length-1].children.push(z),this.stack.push(z),this.tokenStack.push([q,_e||void 0]),z.position={start:ti(q.start),end:void 0}}function l(z){return q;function q(_e){z&&z.call(this,_e),c.call(this,_e)}}function c(z,q){const _e=this.stack.pop(),Q=this.tokenStack.pop();if(Q)Q[0].type!==z.type&&(q?q.call(this,z,Q[0]):(Q[1]||Bg).call(this,z,Q[0]));else throw new Error("Cannot close `"+z.type+"` ("+Yo({start:z.start,end:z.end})+"): it’s not open");_e.position.end=ti(z.end)}function d(){return Sp(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(z){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(z),10),this.data.expectingFirstListItemValue=void 0}}function m(){const z=this.resume(),q=this.stack[this.stack.length-1];q.lang=z}function p(){const z=this.resume(),q=this.stack[this.stack.length-1];q.meta=z}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const z=this.resume(),q=this.stack[this.stack.length-1];q.value=z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const z=this.resume(),q=this.stack[this.stack.length-1];q.value=z.replace(/(\r?\n|\r)$/g,"")}function v(z){const q=this.resume(),_e=this.stack[this.stack.length-1];_e.label=q,_e.identifier=pr(this.sliceSerialize(z)).toLowerCase()}function g(){const z=this.resume(),q=this.stack[this.stack.length-1];q.title=z}function S(){const z=this.resume(),q=this.stack[this.stack.length-1];q.url=z}function k(z){const q=this.stack[this.stack.length-1];if(!q.depth){const _e=this.sliceSerialize(z).length;q.depth=_e}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function T(z){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(z).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function B(z){const _e=this.stack[this.stack.length-1].children;let Q=_e[_e.length-1];(!Q||Q.type!=="text")&&(Q=St(),Q.position={start:ti(z.start),end:void 0},_e.push(Q)),this.stack.push(Q)}function j(z){const q=this.stack.pop();q.value+=this.sliceSerialize(z),q.position.end=ti(z.end)}function F(z){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=q.children[q.children.length-1];_e.position.end=ti(z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&(B.call(this,z),j.call(this,z))}function A(){this.data.atHardBreak=!0}function R(){const z=this.resume(),q=this.stack[this.stack.length-1];q.value=z}function P(){const z=this.resume(),q=this.stack[this.stack.length-1];q.value=z}function N(){const z=this.resume(),q=this.stack[this.stack.length-1];q.value=z}function O(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=q,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function W(){const z=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";z.type+="Reference",z.referenceType=q,delete z.url,delete z.title}else delete z.identifier,delete z.label;this.data.referenceType=void 0}function D(z){const q=this.sliceSerialize(z),_e=this.stack[this.stack.length-2];_e.label=zN(q),_e.identifier=pr(q).toLowerCase()}function I(){const z=this.stack[this.stack.length-1],q=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const Q=z.children;_e.children=Q}else _e.alt=q}function C(){const z=this.resume(),q=this.stack[this.stack.length-1];q.url=z}function X(){const z=this.resume(),q=this.stack[this.stack.length-1];q.title=z}function ie(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function ue(z){const q=this.resume(),_e=this.stack[this.stack.length-1];_e.label=q,_e.identifier=pr(this.sliceSerialize(z)).toLowerCase(),this.data.referenceType="full"}function ve(z){this.data.characterReferenceType=z.type}function Z(z){const q=this.sliceSerialize(z),_e=this.data.characterReferenceType;let Q;_e?(Q=Pw(q,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Q=xp(q);const Re=this.stack[this.stack.length-1];Re.value+=Q}function pe(z){const q=this.stack.pop();q.position.end=ti(z.end)}function ce(z){j.call(this,z);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(z)}function ge(z){j.call(this,z);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(z)}function Pe(){return{type:"blockquote",children:[]}}function we(){return{type:"code",lang:null,meta:null,value:""}}function Be(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ue(){return{type:"emphasis",children:[]}}function M(){return{type:"heading",depth:0,children:[]}}function ae(){return{type:"break"}}function re(){return{type:"html",value:""}}function Ee(){return{type:"image",title:null,url:"",alt:null}}function G(){return{type:"link",title:null,url:"",children:[]}}function se(z){return{type:"list",ordered:z.type==="listOrdered",start:null,spread:z._spread,children:[]}}function ke(z){return{type:"listItem",spread:z._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function Ve(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function mt(){return{type:"thematicBreak"}}}function ti(e){return{line:e.line,column:e.column,offset:e.offset}}function Ww(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ww(e,r):HN(e,r)}}function HN(e,t){let n;for(n in t)if(Hw.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Bg(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Yo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Yo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Yo({start:t.start,end:t.end})+") is still open")}function WN(e){const t=this;t.parser=n;function n(r){return FN(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function UN(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function VN(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
44
|
+
`}]}function qN(e,t){const n=t.value?t.value+`
|
|
45
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function KN(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YN(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function GN(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=oo(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function XN(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JN(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Uw(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function ZN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uw(e,t);const i={src:oo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function QN(e,t){const n={src:oo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function e2(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function t2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Uw(e,t);const i={href:oo(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function n2(e,t){const n={href:oo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function r2(e,t,n){const r=e.all(t),i=n?i2(n):Vw(t),s={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(i||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
46
|
+
`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
47
|
+
`});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function i2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Vw(n[r])}return t}function Vw(e){const t=e.spread;return t??e.children.length>1}function s2(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function o2(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function a2(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function l2(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c2(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=_p(t.children[1]),l=kw(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function u2(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const h=t.children[l],f={},m=o?o[l]:void 0;m&&(f.align=m);let p={type:"element",tagName:s,properties:f,children:[]};h&&(p.children=e.all(h),e.patch(h,p),p=e.applyData(h,p)),c.push(p)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function h2(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Fg=9,$g=32;function d2(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Hg(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Hg(t.slice(i),i>0,!1)),s.join("")}function Hg(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Fg||s===$g;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Fg||s===$g;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function f2(e,t){const n={type:"text",value:d2(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function p2(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const m2={blockquote:UN,break:VN,code:qN,delete:KN,emphasis:YN,footnoteReference:GN,heading:XN,html:JN,imageReference:ZN,image:QN,inlineCode:e2,linkReference:t2,link:n2,listItem:r2,list:s2,paragraph:o2,root:a2,strong:l2,table:c2,tableCell:h2,tableRow:u2,text:f2,thematicBreak:p2,toml:Za,yaml:Za,definition:Za,footnoteDefinition:Za};function Za(){}const qw=-1,qc=0,Xo=1,fc=2,Cp=3,Ep=4,Np=5,jp=6,Kw=7,Yw=8,g2=typeof self=="object"?self:globalThis,Wg=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new g2[e](t)},y2=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case qc:case qw:return n(o,i);case Xo:{const a=n([],i);for(const l of o)a.push(r(l));return a}case fc:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case Cp:return n(new Date(o),i);case Ep:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case Np:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case jp:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case Kw:{const{name:a,message:l}=o;return n(Wg(a,l),i)}case Yw:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(Wg(s,o),i)};return r},Ug=e=>y2(new Map,e)(0),ms="",{toString:_2}={},{keys:v2}=Object,bo=e=>{const t=typeof e;if(t!=="object"||!e)return[qc,t];const n=_2.call(e).slice(8,-1);switch(n){case"Array":return[Xo,ms];case"Object":return[fc,ms];case"Date":return[Cp,ms];case"RegExp":return[Ep,ms];case"Map":return[Np,ms];case"Set":return[jp,ms];case"DataView":return[Xo,n]}return n.includes("Array")?[Xo,n]:n.includes("Error")?[Kw,n]:[fc,n]},Qa=([e,t])=>e===qc&&(t==="function"||t==="symbol"),b2=(e,t,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=bo(o);switch(a){case qc:{let d=o;switch(l){case"bigint":a=Yw,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([qw],o)}return i([a,d],o)}case Xo:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),i([l,[...f]],o)}const d=[],h=i([a,d],o);for(const f of o)d.push(s(f));return h}case fc:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],h=i([a,d],o);for(const f of v2(o))(e||!Qa(bo(o[f])))&&d.push([s(f),s(o[f])]);return h}case Cp:return i([a,o.toISOString()],o);case Ep:{const{source:d,flags:h}=o;return i([a,{source:d,flags:h}],o)}case Np:{const d=[],h=i([a,d],o);for(const[f,m]of o)(e||!(Qa(bo(f))||Qa(bo(m))))&&d.push([s(f),s(m)]);return h}case jp:{const d=[],h=i([a,d],o);for(const f of o)(e||!Qa(bo(f)))&&d.push(s(f));return h}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},Vg=(e,{json:t,lossy:n}={})=>{const r=[];return b2(!(t||n),!!t,new Map,r)(e),r},pc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ug(Vg(e,t)):structuredClone(e):(e,t)=>Ug(Vg(e,t));function w2(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function S2(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function x2(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||w2,r=e.options.footnoteBackLabel||S2,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const d=e.all(c),h=String(c.identifier).toUpperCase(),f=oo(h.toLowerCase());let m=0;const p=[],y=e.footnoteCounts.get(h);for(;y!==void 0&&++m<=y;){p.length>0&&p.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,m);typeof v=="string"&&(v={type:"text",value:v}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...p)}else d.push(...p);const _={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,_),a.push(_)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...pc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
48
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
49
|
+
`}]}}const Kc=function(e){if(e==null)return N2;if(typeof e=="function")return Yc(e);if(typeof e=="object")return Array.isArray(e)?k2(e):C2(e);if(typeof e=="string")return E2(e);throw new Error("Expected function, string, or object as test")};function k2(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Kc(e[n]);return Yc(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function C2(e){const t=e;return Yc(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function E2(e){return Yc(t);function t(n){return n&&n.type===e}}function Yc(e){return t;function t(n,r,i){return!!(j2(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function N2(){return!0}function j2(e){return e!==null&&typeof e=="object"&&"type"in e}const Gw=[],R2=!0,Cd=!1,T2="skip";function Xw(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Kc(i),o=r?-1:1;a(e,void 0,[])();function a(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=Gw,p,y,b;if((!t||s(l,c,d[d.length-1]||void 0))&&(m=D2(n(l,d)),m[0]===Cd))return m;if("children"in l&&l.children){const _=l;if(_.children&&m[0]!==T2)for(y=(r?_.children.length:-1)+o,b=d.concat(_);y>-1&&y<_.children.length;){const v=_.children[y];if(p=a(v,y,b)(),p[0]===Cd)return p;y=typeof p[1]=="number"?p[1]:y+o}}return m}}}function D2(e){return Array.isArray(e)?e:typeof e=="number"?[R2,e]:e==null?Gw:[e]}function Rp(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),Xw(e,s,a,i);function a(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return o(l,h,d)}}const Ed={}.hasOwnProperty,P2={};function L2(e,t){const n=t||P2,r=new Map,i=new Map,s=new Map,o={...m2,...n.handlers},a={all:c,applyData:I2,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:A2,wrap:O2};return Rp(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),a;function l(d,h){const f=d.type,m=a.handlers[f];if(Ed.call(a.handlers,f)&&m)return m(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in d){const{children:y,...b}=d,_=pc(b);return _.children=a.all(d),_}return pc(d)}return(a.options.unknownHandler||M2)(a,d,h)}function c(d){const h=[];if("children"in d){const f=d.children;let m=-1;for(;++m<f.length;){const p=a.one(f[m],d);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=qg(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=qg(y.value))}Array.isArray(p)?h.push(...p):h.push(p)}}}return h}}function A2(e,t){e.position&&(t.position=wC(e))}function I2(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,pc(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function M2(e,t){const n=t.data||{},r="value"in t&&!(Ed.call(n,"hProperties")||Ed.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function O2(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
50
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
51
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
52
|
+
`}),n}function qg(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Kg(e,t){const n=L2(e,t),r=n.one(e,void 0),i=x2(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
53
|
+
`},i),s}function z2(e,t){return e&&"run"in e?async function(n,r){const i=Kg(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Kg(n,{file:r,...e||t})}}function Yg(e){if(e)throw e}var Dl=Object.prototype.hasOwnProperty,Jw=Object.prototype.toString,Gg=Object.defineProperty,Xg=Object.getOwnPropertyDescriptor,Jg=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Jw.call(t)==="[object Array]"},Zg=function(t){if(!t||Jw.call(t)!=="[object Object]")return!1;var n=Dl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Dl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Dl.call(t,i)},Qg=function(t,n){Gg&&n.name==="__proto__"?Gg(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ey=function(t,n){if(n==="__proto__")if(Dl.call(t,n)){if(Xg)return Xg(t,n).value}else return;return t[n]},B2=function e(){var t,n,r,i,s,o,a=arguments[0],l=1,c=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=ey(a,n),i=ey(t,n),a!==i&&(d&&i&&(Zg(i)||(s=Jg(i)))?(s?(s=!1,o=r&&Jg(r)?r:[]):o=r&&Zg(r)?r:{},Qg(a,{name:n,newValue:e(d,o,i)})):typeof i<"u"&&Qg(a,{name:n,newValue:i}));return a};const Fu=ba(B2);function Nd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function F2(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const d=e[++s];let h=-1;if(l){o(l);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?$2(d,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function $2(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(i);try{l=e.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return i(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const xr={basename:H2,dirname:W2,extname:U2,join:V2,sep:"/"};function H2(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ja(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function W2(e){if(ja(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function U2(e){ja(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function V2(...e){let t=-1,n;for(;++t<e.length;)ja(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":q2(n)}function q2(e){ja(e);const t=e.codePointAt(0)===47;let n=K2(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function K2(e,t){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function ja(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Y2={cwd:G2};function G2(){return"/"}function jd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function X2(e){if(typeof e=="string")e=new URL(e);else if(!jd(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return J2(e)}function J2(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const $u=["history","path","basename","stem","extname","dirname"];class Zw{constructor(t){let n;t?jd(t)?n={path:t}:typeof t=="string"||Z2(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Y2.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<$u.length;){const s=$u[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)$u.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?xr.basename(this.path):void 0}set basename(t){Wu(t,"basename"),Hu(t,"basename"),this.path=xr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?xr.dirname(this.path):void 0}set dirname(t){ty(this.basename,"dirname"),this.path=xr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?xr.extname(this.path):void 0}set extname(t){if(Hu(t,"extname"),ty(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=xr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){jd(t)&&(t=X2(t)),Wu(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?xr.basename(this.path,this.extname):void 0}set stem(t){Wu(t,"stem"),Hu(t,"stem"),this.path=xr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new mn(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Hu(e,t){if(e&&e.includes(xr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+xr.sep+"`")}function Wu(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ty(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Z2(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Q2=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},ej={}.hasOwnProperty;class Tp extends Q2{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=F2()}copy(){const t=new Tp;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Fu(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(qu("data",this.frozen),this.namespace[t]=n,this):ej.call(this.namespace,t)&&this.namespace[t]||void 0:t?(qu("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=el(t),r=this.parser||this.Parser;return Uu("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Uu("process",this.parser||this.Parser),Vu("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=el(t),l=r.parse(a);r.run(l,a,function(d,h,f){if(d||!h||!f)return c(d);const m=h,p=r.stringify(m,f);rj(p)?f.value=p:f.result=p,c(d,f)});function c(d,h){d||!h?o(d):s?s(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Uu("processSync",this.parser||this.Parser),Vu("processSync",this.compiler||this.Compiler),this.process(t,i),ry("processSync","process",n),r;function i(s,o){n=!0,Yg(s),r=o}}run(t,n,r){ny(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=el(n);i.run(t,l,c);function c(d,h,f){const m=h||t;d?a(d):o?o(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),ry("runSync","run",r),i;function s(o,a){Yg(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=el(n),i=this.compiler||this.Compiler;return Vu("stringify",i),ny(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(qu("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=Fu(!0,i.settings,c.settings))}function a(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let h=-1,f=-1;for(;++h<r.length;)if(r[h][0]===c){f=h;break}if(f===-1)r.push([c,...d]);else if(d.length>0){let[m,...p]=d;const y=r[f][1];Nd(y)&&Nd(m)&&(m=Fu(!0,y,m)),r[f]=[c,m,...p]}}}}const tj=new Tp().freeze();function Uu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vu(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qu(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ny(e){if(!Nd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ry(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function el(e){return nj(e)?e:new Zw(e)}function nj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function rj(e){return typeof e=="string"||ij(e)}function ij(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",iy=[],sy={allowDangerousHtml:!0},oj=/^(https?|ircs?|mailto|xmpp)$/i,aj=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function lj(e){const t=cj(e),n=uj(e);return hj(t.runSync(t.parse(n),n),e)}function cj(e){const t=e.rehypePlugins||iy,n=e.remarkPlugins||iy,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...sy}:sy;return tj().use(WN).use(n).use(z2,r).use(t)}function uj(e){const t=e.children||"",n=new Zw;return typeof t=="string"&&(n.value=t),n}function hj(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||dj;for(const d of aj)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+sj+d.id,void 0);return Rp(e,c),EC(e,{Fragment:u.Fragment,components:i,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let m;for(m in Ou)if(Object.hasOwn(Ou,m)&&Object.hasOwn(d.properties,m)){const p=d.properties[m],y=Ou[m];(y===null||y.includes(d.tagName))&&(d.properties[m]=l(String(p||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!m&&r&&typeof h=="number"&&(m=!r(d,h,f)),m&&f&&typeof h=="number")return a&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function dj(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||oj.test(e.slice(0,t))?e:""}function oy(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function fj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function pj(e,t,n){const i=Kc((n||{}).ignore||[]),s=mj(t);let o=-1;for(;++o<s.length;)Xw(e,"text",a);function a(c,d){let h=-1,f;for(;++h<d.length;){const m=d[h],p=f?f.children:void 0;if(i(m,p?p.indexOf(m):void 0,f))return;f=m}if(f)return l(c,d)}function l(c,d){const h=d[d.length-1],f=s[o][0],m=s[o][1];let p=0;const b=h.children.indexOf(c);let _=!1,v=[];f.lastIndex=0;let g=f.exec(c.value);for(;g;){const S=g.index,k={index:g.index,input:g.input,stack:[...d,c]};let x=m(...g,k);if(typeof x=="string"&&(x=x.length>0?{type:"text",value:x}:void 0),x===!1?f.lastIndex=S+1:(p!==S&&v.push({type:"text",value:c.value.slice(p,S)}),Array.isArray(x)?v.push(...x):x&&v.push(x),p=S+g[0].length,_=!0),!f.global)break;g=f.exec(c.value)}return _?(p<c.value.length&&v.push({type:"text",value:c.value.slice(p)}),h.children.splice(b,1,...v)):v=[c],b+v.length}}function mj(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([gj(i[0]),yj(i[1])])}return t}function gj(e){return typeof e=="string"?new RegExp(fj(e),"g"):e}function yj(e){return typeof e=="function"?e:function(){return e}}const Ku="phrasing",Yu=["autolink","link","image","label"];function _j(){return{transforms:[Cj],enter:{literalAutolink:bj,literalAutolinkEmail:Gu,literalAutolinkHttp:Gu,literalAutolinkWww:Gu},exit:{literalAutolink:kj,literalAutolinkEmail:xj,literalAutolinkHttp:wj,literalAutolinkWww:Sj}}}function vj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ku,notInConstruct:Yu},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ku,notInConstruct:Yu},{character:":",before:"[ps]",after:"\\/",inConstruct:Ku,notInConstruct:Yu}]}}function bj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Gu(e){this.config.enter.autolinkProtocol.call(this,e)}function wj(e){this.config.exit.autolinkProtocol.call(this,e)}function Sj(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function xj(e){this.config.exit.autolinkEmail.call(this,e)}function kj(e){this.exit(e)}function Cj(e){pj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ej],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nj]],{ignore:["link","linkReference"]})}function Ej(e,t,n,r,i){let s="";if(!Qw(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!jj(n)))return!1;const o=Rj(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function Nj(e,t,n,r){return!Qw(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function jj(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Rj(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=oy(e,"(");let s=oy(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Qw(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ss(n)||Uc(n))&&(!t||n!==47)}eS.peek=zj;function Tj(){this.buffer()}function Dj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Pj(){this.buffer()}function Lj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Aj(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ij(e){this.exit(e)}function Mj(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Oj(e){this.exit(e)}function zj(){return"["}function eS(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function Bj(){return{enter:{gfmFootnoteCallString:Tj,gfmFootnoteCall:Dj,gfmFootnoteDefinitionLabelString:Pj,gfmFootnoteDefinition:Lj},exit:{gfmFootnoteCallString:Aj,gfmFootnoteCall:Ij,gfmFootnoteDefinitionLabelString:Mj,gfmFootnoteDefinition:Oj}}}function Fj(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:eS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=s.enter("footnoteDefinition"),d=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),d(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
54
|
+
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?tS:$j))),c(),l}}function $j(e,t,n){return t===0?e:tS(e,t,n)}function tS(e,t,n){return(n?"":" ")+e}const Hj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];nS.peek=Kj;function Wj(){return{canContainEols:["delete"],enter:{strikethrough:Vj},exit:{strikethrough:qj}}}function Uj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Hj}],handlers:{delete:nS}}}function Vj(e){this.enter({type:"delete",children:[]},e)}function qj(e){this.exit(e)}function nS(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function Kj(){return"~"}function Yj(e){return e.length}function Gj(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Yj,s=[],o=[],a=[],l=[];let c=0,d=-1;for(;++d<e.length;){const y=[],b=[];let _=-1;for(e[d].length>c&&(c=e[d].length);++_<e[d].length;){const v=Xj(e[d][_]);if(n.alignDelimiters!==!1){const g=i(v);b[_]=g,(l[_]===void 0||g>l[_])&&(l[_]=g)}y.push(v)}o[d]=y,a[d]=b}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<c;)s[h]=ay(r[h]);else{const y=ay(r);for(;++h<c;)s[h]=y}h=-1;const f=[],m=[];for(;++h<c;){const y=s[h];let b="",_="";y===99?(b=":",_=":"):y===108?b=":":y===114&&(_=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[h]-b.length-_.length);const g=b+"-".repeat(v)+_;n.alignDelimiters!==!1&&(v=b.length+v+_.length,v>l[h]&&(l[h]=v),m[h]=v),f[h]=g}o.splice(1,0,f),a.splice(1,0,m),d=-1;const p=[];for(;++d<o.length;){const y=o[d],b=a[d];h=-1;const _=[];for(;++h<c;){const v=y[h]||"";let g="",S="";if(n.alignDelimiters!==!1){const k=l[h]-(b[h]||0),x=s[h];x===114?g=" ".repeat(k):x===99?k%2?(g=" ".repeat(k/2+.5),S=" ".repeat(k/2-.5)):(g=" ".repeat(k/2),S=g):S=" ".repeat(k)}n.delimiterStart!==!1&&!h&&_.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||h)&&_.push(" "),n.alignDelimiters!==!1&&_.push(g),_.push(v),n.alignDelimiters!==!1&&_.push(S),n.padding!==!1&&_.push(" "),(n.delimiterEnd!==!1||h!==c-1)&&_.push("|")}p.push(n.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return p.join(`
|
|
55
|
+
`)}function Xj(e){return e==null?"":String(e)}function ay(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Jj(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),Zj);return i(),o}function Zj(e,t,n){return">"+(n?"":" ")+e}function Qj(e,t){return ly(e,t.inConstruct,!0)&&!ly(e,t.notInConstruct,!1)}function ly(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function cy(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
56
|
+
`&&Qj(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
57
|
+
`}function eR(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function tR(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function nR(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rR(e,t,n,r){const i=nR(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(tR(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(s,iR);return h(),f}const a=n.createTracker(r),l=i.repeat(Math.max(eR(s,i)+1,3)),c=n.enter("codeFenced");let d=a.move(l);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
|
|
58
|
+
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
|
|
59
|
+
`),s&&(d+=a.move(s+`
|
|
60
|
+
`)),d+=a.move(l),c(),d}function iR(e,t,n){return(n?"":" ")+e}function Dp(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function sR(e,t,n,r){const i=Dp(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
|
|
61
|
+
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function oR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ga(e){return"&#x"+e.toString(16).toUpperCase()+";"}function mc(e,t,n){const r=eo(e),i=eo(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}rS.peek=aR;function rS(e,t,n,r){const i=oR(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),d=mc(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(l=ga(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=mc(r.after.charCodeAt(0),h,i);f.inside&&(l=l.slice(0,-1)+ga(h));const m=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+m}function aR(e,t,n){return n.options.emphasis||"*"}function lR(e,t){let n=!1;return Rp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Cd}),!!((!e.depth||e.depth<3)&&Sp(e)&&(t.options.setext||n))}function cR(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(lR(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...s.current(),before:`
|
|
62
|
+
`,after:`
|
|
63
|
+
`});return h(),d(),f+`
|
|
64
|
+
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
65
|
+
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
66
|
+
`,...s.current()});return/^[\t ]/.test(c)&&(c=ga(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}iS.peek=uR;function iS(e){return e.value||""}function uR(){return"<"}sS.peek=hR;function sS(e,t,n,r){const i=Dp(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function hR(){return"!"}oS.peek=dR;function oS(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,s(),i==="full"||!c||c!==h?l+=a.move(h+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function dR(){return"!"}aS.peek=fR;function aS(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function fR(){return"`"}function lS(e,t){const n=Sp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}cS.peek=pR;function cS(e,t,n,r){const i=Dp(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(lS(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function pR(e,t,n){return lS(e,n)?"<":"["}uS.peek=mR;function uS(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,s(),i==="full"||!c||c!==h?l+=a.move(h+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function mR(){return"["}function Pp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function gR(e){const t=Pp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function yR(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function hS(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function _R(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?yR(n):Pp(n);const a=e.ordered?o==="."?")":".":gR(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),hS(n)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function vR(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function bR(e,t,n,r){const i=vR(n);let s=n.bulletCurrent||Pp(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),d);return l(),c;function d(h,f,m){return f?(m?"":" ".repeat(o))+h:(m?s:s+" ".repeat(o-s.length))+h}}function wR(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const SR=Kc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xR(e,t,n,r){return(e.children.some(function(o){return SR(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function kR(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dS.peek=CR;function dS(e,t,n,r){const i=kR(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),d=mc(r.before.charCodeAt(r.before.length-1),c,i);d.inside&&(l=ga(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=mc(r.after.charCodeAt(0),h,i);f.inside&&(l=l.slice(0,-1)+ga(h));const m=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+m}function CR(e,t,n){return n.options.strong||"*"}function ER(e,t,n,r){return n.safe(e.value,r)}function NR(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function jR(e,t,n){const r=(hS(n)+(n.options.ruleSpaces?" ":"")).repeat(NR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const fS={blockquote:Jj,break:cy,code:rR,definition:sR,emphasis:rS,hardBreak:cy,heading:cR,html:iS,image:sS,imageReference:oS,inlineCode:aS,link:cS,linkReference:uS,list:_R,listItem:bR,paragraph:wR,root:xR,strong:dS,text:ER,thematicBreak:jR};function RR(){return{enter:{table:TR,tableData:uy,tableHeader:uy,tableRow:PR},exit:{codeText:LR,table:DR,tableData:Xu,tableHeader:Xu,tableRow:Xu}}}function TR(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function DR(e){this.exit(e),this.data.inTable=void 0}function PR(e){this.enter({type:"tableRow",children:[]},e)}function Xu(e){this.exit(e)}function uy(e){this.enter({type:"tableCell",children:[]},e)}function LR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,AR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function AR(e,t){return t==="|"?t:e}function IR(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
67
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(m,p,y,b){return c(d(m,y,b),m.align)}function a(m,p,y,b){const _=h(m,y,b),v=c([_]);return v.slice(0,v.indexOf(`
|
|
68
|
+
`))}function l(m,p,y,b){const _=y.enter("tableCell"),v=y.enter("phrasing"),g=y.containerPhrasing(m,{...b,before:s,after:s});return v(),_(),g}function c(m,p){return Gj(m,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function d(m,p,y){const b=m.children;let _=-1;const v=[],g=p.enter("table");for(;++_<b.length;)v[_]=h(b[_],p,y);return g(),v}function h(m,p,y){const b=m.children;let _=-1;const v=[],g=p.enter("tableRow");for(;++_<b.length;)v[_]=l(b[_],m,p,y);return g(),v}function f(m,p,y){let b=fS.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function MR(){return{exit:{taskListCheckValueChecked:hy,taskListCheckValueUnchecked:hy,paragraph:zR}}}function OR(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:BR}}}function hy(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function zR(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function BR(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=fS.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(d){return d+o}}function FR(){return[_j(),Bj(),Wj(),RR(),MR()]}function $R(e){return{extensions:[vj(),Fj(e),Uj(),IR(e),OR()]}}const HR={tokenize:YR,partial:!0},pS={tokenize:GR,partial:!0},mS={tokenize:XR,partial:!0},gS={tokenize:JR,partial:!0},WR={tokenize:ZR,partial:!0},yS={name:"wwwAutolink",tokenize:qR,previous:vS},_S={name:"protocolAutolink",tokenize:KR,previous:bS},Gr={name:"emailAutolink",tokenize:VR,previous:wS},Lr={};function UR(){return{text:Lr}}let Ii=48;for(;Ii<123;)Lr[Ii]=Gr,Ii++,Ii===58?Ii=65:Ii===91&&(Ii=97);Lr[43]=Gr;Lr[45]=Gr;Lr[46]=Gr;Lr[95]=Gr;Lr[72]=[Gr,_S];Lr[104]=[Gr,_S];Lr[87]=[Gr,yS];Lr[119]=[Gr,yS];function VR(e,t,n){const r=this;let i,s;return o;function o(h){return!Rd(h)||!wS.call(r,r.previous)||Lp(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return Rd(h)?(e.consume(h),a):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(WR,d,c)(h):h===45||h===95||fn(h)?(s=!0,e.consume(h),l):d(h)}function c(h){return e.consume(h),i=!0,l}function d(h){return s&&i&&vn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function qR(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!vS.call(r,r.previous)||Lp(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(HR,e.attempt(pS,e.attempt(mS,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function KR(e,t,n){const r=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&bS.call(r,r.previous)&&!Lp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(vn(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),s?c:(s=!0,l)):n(h)}function c(h){return h===null||dc(h)||nt(h)||ss(h)||Uc(h)?n(h):e.attempt(pS,e.attempt(mS,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function YR(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function GR(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(gS,l,a)(c):c===null||nt(c)||ss(c)||c!==45&&Uc(c)?l(c):(s=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function l(c){return i||r||!s?n(c):t(c)}}function XR(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(gS,t,s)(o):o===null||nt(o)||ss(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function JR(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||nt(a)||ss(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||nt(a)||ss(a)?t(a):r(a)}function s(a){return vn(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):vn(a)?(e.consume(a),o):n(a)}}function ZR(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return fn(s)?n(s):t(s)}}function vS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||nt(e)}function bS(e){return!vn(e)}function wS(e){return!(e===47||Rd(e))}function Rd(e){return e===43||e===45||e===46||e===95||fn(e)}function Lp(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const QR={tokenize:aT,partial:!0};function eT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:iT,continuation:{tokenize:sT},exit:oT}},text:{91:{name:"gfmFootnoteCall",tokenize:rT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tT,resolveTo:nT}}}}function tT(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=pr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function nT(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function rT(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(s>999||h===93&&!o||h===null||h===91||nt(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(pr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return nt(h)||(o=!0),s++,e.consume(h),h===92?d:c}function d(h){return h===91||h===92||h===93?(e.consume(h),s++,c):c(h)}}function iT(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(p)}function d(p){if(o>999||p===93&&!a||p===null||p===91||nt(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return s=pr(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return nt(p)||(a=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ge(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function sT(e,t,n){return e.check(Na,t,e.attempt(QR,t,n))}function oT(e){e.exit("gfmFootnoteDefinition")}function aT(e,t,n){const r=this;return Ge(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function lT(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",d,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",h,a]],m=a.parser.constructs.insideSpan.null;m&&Hn(f,f.length,0,Vc(m,o.slice(c+1,l),a)),Hn(f,f.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),Hn(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,d=this.events;let h=0;return f;function f(p){return c===126&&d[d.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const y=eo(c);if(p===126)return h>1?l(p):(o.consume(p),h++,m);if(h<2&&!n)return l(p);const b=o.exit("strikethroughSequenceTemporary"),_=eo(p);return b._open=!_||_===2&&!!y,b._close=!y||y===2&&!!_,a(p)}}}class cT{constructor(){this.map=[]}add(t,n,r){uT(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function uT(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function hT(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function dT(){return{flow:{null:{name:"table",tokenize:fT,resolveAll:pT}}}}function fT(e,t,n){const r=this;let i=0,s=0,o;return a;function a(j){let F=r.events.length-1;for(;F>-1;){const P=r.events[F][1].type;if(P==="lineEnding"||P==="linePrefix")F--;else break}const A=F>-1?r.events[F][1].type:null,R=A==="tableHead"||A==="tableRow"?x:l;return R===x&&r.parser.lazy[r.now().line]?n(j):R(j)}function l(j){return e.enter("tableHead"),e.enter("tableRow"),c(j)}function c(j){return j===124||(o=!0,s+=1),d(j)}function d(j){return j===null?n(j):xe(j)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),m):n(j):He(j)?Ge(e,d,"whitespace")(j):(s+=1,o&&(o=!1,i+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(j)))}function h(j){return j===null||j===124||nt(j)?(e.exit("data"),d(j)):(e.consume(j),j===92?f:h)}function f(j){return j===92||j===124?(e.consume(j),h):h(j)}function m(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),o=!1,He(j)?Ge(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):p(j))}function p(j){return j===45||j===58?b(j):j===124?(o=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),y):k(j)}function y(j){return He(j)?Ge(e,b,"whitespace")(j):b(j)}function b(j){return j===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),_):j===45?(s+=1,_(j)):j===null||xe(j)?S(j):k(j)}function _(j){return j===45?(e.enter("tableDelimiterFiller"),v(j)):k(j)}function v(j){return j===45?(e.consume(j),v):j===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(j))}function g(j){return He(j)?Ge(e,S,"whitespace")(j):S(j)}function S(j){return j===124?p(j):j===null||xe(j)?!o||i!==s?k(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):k(j)}function k(j){return n(j)}function x(j){return e.enter("tableRow"),T(j)}function T(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),T):j===null||xe(j)?(e.exit("tableRow"),t(j)):He(j)?Ge(e,T,"whitespace")(j):(e.enter("data"),L(j))}function L(j){return j===null||j===124||nt(j)?(e.exit("data"),T(j)):(e.consume(j),j===92?B:L)}function B(j){return j===92||j===124?(e.consume(j),L):L(j)}}function pT(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,d,h;const f=new cT;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(dy(f,t,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,h=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",d,t]])),i=p.type==="tableDelimiterRow"?2:d?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=tl(f,t,s,i,void 0,h),s=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],h=tl(f,t,s,i,void 0,h)),s=o,o=[s[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],h=tl(f,t,s,i,n,h)):o[1]!==0&&(h=tl(f,t,o,i,n,h)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&dy(f,t,l,c,d),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=hT(t.events,n))}return e}function tl(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},ws(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=ws(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=ws(t.events,n[2]),d=ws(t.events,n[3]),h={type:a,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,y=n[3]-n[2]-1;e.add(p,y,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(s.end=Object.assign({},ws(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function dy(e,t,n,r,i){const s=[],o=ws(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function ws(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const mT={name:"tasklistCheck",tokenize:yT};function gT(){return{text:{91:mT}}}function yT(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return nt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return xe(l)?t(l):He(l)?e.check({tokenize:_T},t,n)(l):n(l)}}function _T(e,t,n){return Ge(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function vT(e){return Dw([UR(),eT(),lT(e),dT(),gT()])}const bT={};function wT(e){const t=this,n=e||bT,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(vT(n)),s.push(FR()),o.push($R(n))}function SS(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=SS(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ao(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=SS(e))&&(r&&(r+=" "),r+=t);return r}var ST=Object.create,Gc=Object.defineProperty,xT=Object.defineProperties,kT=Object.getOwnPropertyDescriptor,CT=Object.getOwnPropertyDescriptors,xS=Object.getOwnPropertyNames,gc=Object.getOwnPropertySymbols,ET=Object.getPrototypeOf,Ap=Object.prototype.hasOwnProperty,kS=Object.prototype.propertyIsEnumerable,fy=(e,t,n)=>t in e?Gc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tr=(e,t)=>{for(var n in t||(t={}))Ap.call(t,n)&&fy(e,n,t[n]);if(gc)for(var n of gc(t))kS.call(t,n)&&fy(e,n,t[n]);return e},Xc=(e,t)=>xT(e,CT(t)),CS=(e,t)=>{var n={};for(var r in e)Ap.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gc)for(var r of gc(e))t.indexOf(r)<0&&kS.call(e,r)&&(n[r]=e[r]);return n},NT=(e,t)=>function(){return t||(0,e[xS(e)[0]])((t={exports:{}}).exports,t),t.exports},jT=(e,t)=>{for(var n in t)Gc(e,n,{get:t[n],enumerable:!0})},RT=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of xS(t))!Ap.call(e,i)&&i!==n&&Gc(e,i,{get:()=>t[i],enumerable:!(r=kT(t,i))||r.enumerable});return e},TT=(e,t,n)=>(n=e!=null?ST(ET(e)):{},RT(!e||!e.__esModule?Gc(n,"default",{value:e,enumerable:!0}):n,e)),DT=NT({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var r=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,s={},o={util:{encode:function p(y){return y instanceof a?new a(y.type,p(y.content),y.alias):Array.isArray(y)?y.map(p):y.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(p){return Object.prototype.toString.call(p).slice(8,-1)},objId:function(p){return p.__id||Object.defineProperty(p,"__id",{value:++i}),p.__id},clone:function p(y,b){b=b||{};var _,v;switch(o.util.type(y)){case"Object":if(v=o.util.objId(y),b[v])return b[v];_={},b[v]=_;for(var g in y)y.hasOwnProperty(g)&&(_[g]=p(y[g],b));return _;case"Array":return v=o.util.objId(y),b[v]?b[v]:(_=[],b[v]=_,y.forEach(function(S,k){_[k]=p(S,b)}),_);default:return y}},getLanguage:function(p){for(;p;){var y=r.exec(p.className);if(y)return y[1].toLowerCase();p=p.parentElement}return"none"},setLanguage:function(p,y){p.className=p.className.replace(RegExp(r,"gi"),""),p.classList.add("language-"+y)},isActive:function(p,y,b){for(var _="no-"+y;p;){var v=p.classList;if(v.contains(y))return!0;if(v.contains(_))return!1;p=p.parentElement}return!!b}},languages:{plain:s,plaintext:s,text:s,txt:s,extend:function(p,y){var b=o.util.clone(o.languages[p]);for(var _ in y)b[_]=y[_];return b},insertBefore:function(p,y,b,_){_=_||o.languages;var v=_[p],g={};for(var S in v)if(v.hasOwnProperty(S)){if(S==y)for(var k in b)b.hasOwnProperty(k)&&(g[k]=b[k]);b.hasOwnProperty(S)||(g[S]=v[S])}var x=_[p];return _[p]=g,o.languages.DFS(o.languages,function(T,L){L===x&&T!=p&&(this[T]=g)}),g},DFS:function p(y,b,_,v){v=v||{};var g=o.util.objId;for(var S in y)if(y.hasOwnProperty(S)){b.call(y,S,y[S],_||S);var k=y[S],x=o.util.type(k);x==="Object"&&!v[g(k)]?(v[g(k)]=!0,p(k,b,null,v)):x==="Array"&&!v[g(k)]&&(v[g(k)]=!0,p(k,b,S,v))}}},plugins:{},highlight:function(p,y,b){var _={code:p,grammar:y,language:b};if(o.hooks.run("before-tokenize",_),!_.grammar)throw new Error('The language "'+_.language+'" has no grammar.');return _.tokens=o.tokenize(_.code,_.grammar),o.hooks.run("after-tokenize",_),a.stringify(o.util.encode(_.tokens),_.language)},tokenize:function(p,y){var b=y.rest;if(b){for(var _ in b)y[_]=b[_];delete y.rest}var v=new d;return h(v,v.head,p),c(p,v,y,v.head,0),m(v)},hooks:{all:{},add:function(p,y){var b=o.hooks.all;b[p]=b[p]||[],b[p].push(y)},run:function(p,y){var b=o.hooks.all[p];if(!(!b||!b.length))for(var _=0,v;v=b[_++];)v(y)}},Token:a};function a(p,y,b,_){this.type=p,this.content=y,this.alias=b,this.length=(_||"").length|0}a.stringify=function p(y,b){if(typeof y=="string")return y;if(Array.isArray(y)){var _="";return y.forEach(function(x){_+=p(x,b)}),_}var v={type:y.type,content:p(y.content,b),tag:"span",classes:["token",y.type],attributes:{},language:b},g=y.alias;g&&(Array.isArray(g)?Array.prototype.push.apply(v.classes,g):v.classes.push(g)),o.hooks.run("wrap",v);var S="";for(var k in v.attributes)S+=" "+k+'="'+(v.attributes[k]||"").replace(/"/g,""")+'"';return"<"+v.tag+' class="'+v.classes.join(" ")+'"'+S+">"+v.content+"</"+v.tag+">"};function l(p,y,b,_){p.lastIndex=y;var v=p.exec(b);if(v&&_&&v[1]){var g=v[1].length;v.index+=g,v[0]=v[0].slice(g)}return v}function c(p,y,b,_,v,g){for(var S in b)if(!(!b.hasOwnProperty(S)||!b[S])){var k=b[S];k=Array.isArray(k)?k:[k];for(var x=0;x<k.length;++x){if(g&&g.cause==S+","+x)return;var T=k[x],L=T.inside,B=!!T.lookbehind,j=!!T.greedy,F=T.alias;if(j&&!T.pattern.global){var A=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,A+"g")}for(var R=T.pattern||T,P=_.next,N=v;P!==y.tail&&!(g&&N>=g.reach);N+=P.value.length,P=P.next){var O=P.value;if(y.length>p.length)return;if(!(O instanceof a)){var W=1,D;if(j){if(D=l(R,N,p,B),!D||D.index>=p.length)break;var ie=D.index,I=D.index+D[0].length,C=N;for(C+=P.value.length;ie>=C;)P=P.next,C+=P.value.length;if(C-=P.value.length,N=C,P.value instanceof a)continue;for(var X=P;X!==y.tail&&(C<I||typeof X.value=="string");X=X.next)W++,C+=X.value.length;W--,O=p.slice(N,C),D.index-=N}else if(D=l(R,0,O,B),!D)continue;var ie=D.index,E=D[0],ue=O.slice(0,ie),ve=O.slice(ie+E.length),Z=N+O.length;g&&Z>g.reach&&(g.reach=Z);var pe=P.prev;ue&&(pe=h(y,pe,ue),N+=ue.length),f(y,pe,W);var ce=new a(S,L?o.tokenize(E,L):E,F,E);if(P=h(y,pe,ce),ve&&h(y,P,ve),W>1){var ge={cause:S+","+x,reach:Z};c(p,y,b,P.prev,N,ge),g&&ge.reach>g.reach&&(g.reach=ge.reach)}}}}}}function d(){var p={value:null,prev:null,next:null},y={value:null,prev:p,next:null};p.next=y,this.head=p,this.tail=y,this.length=0}function h(p,y,b){var _=y.next,v={value:b,prev:y,next:_};return y.next=v,_.prev=v,p.length++,v}function f(p,y,b){for(var _=y.next,v=0;v<b&&_!==p.tail;v++)_=_.next;y.next=_,_.prev=y,p.length-=v}function m(p){for(var y=[],b=p.head.next;b!==p.tail;)y.push(b.value),b=b.next;return y}return o}();t.exports=n,n.default=n}}),U=TT(DT());U.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},U.languages.markup.tag.inside["attr-value"].inside.entity=U.languages.markup.entity,U.languages.markup.doctype.inside["internal-subset"].inside=U.languages.markup,U.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(U.languages.markup.tag,"addInlined",{value:function(e,r){var n={},n=(n["language-"+r]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:U.languages[r]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}),r=(n["language-"+r]={pattern:/[\s\S]+/,inside:U.languages[r]},{});r[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},U.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(U.languages.markup.tag,"addAttribute",{value:function(e,t){U.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:U.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),U.languages.html=U.languages.markup,U.languages.mathml=U.languages.markup,U.languages.svg=U.languages.markup,U.languages.xml=U.languages.extend("markup",{}),U.languages.ssml=U.languages.xml,U.languages.atom=U.languages.xml,U.languages.rss=U.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r="(?:[^\\\\-]|"+n.source+")",r=RegExp(r+"-"+r),i={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":i}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:"punctuation",inside:{"group-name":i}},{pattern:/\)/,alias:"punctuation"}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:"number"},alternation:{pattern:/\|/,alias:"keyword"}}}(U),U.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},U.languages.javascript=U.languages.extend("clike",{"class-name":[U.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),U.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,U.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:U.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:U.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:U.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:U.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:U.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),U.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:U.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),U.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),U.languages.markup&&(U.languages.markup.tag.addInlined("script","javascript"),U.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),U.languages.js=U.languages.javascript,U.languages.actionscript=U.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),U.languages.actionscript["class-name"].alias="function",delete U.languages.actionscript.parameter,delete U.languages.actionscript["literal-property"],U.languages.markup&&U.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:U.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(U),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(n,r){(n=typeof n=="string"?[n]:n).forEach(function(i){var s=function(h){h.inside||(h.inside={}),h.inside.rest=r},o="doc-comment";if(a=e.languages[i]){var a,l=a[o];if((l=l||(a=e.languages.insertBefore(i,"comment",{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:"comment"}}))[o])instanceof RegExp&&(l=a[o]={pattern:l}),Array.isArray(l))for(var c=0,d=l.length;c<d;c++)l[c]instanceof RegExp&&(l[c]={pattern:l[c]}),s(l[c]);else s(l)}})}}),t.addSupport(["java","javascript","php"],t)}(U),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup);t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(U),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+t.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(U),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+n.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),s=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(a,l){l=(l||"").replace(/m/g,"")+"m";var c=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return a});return RegExp(c,l)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+i+"|"+s+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(s),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(U),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(c){return c=c.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+c+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source,o=(e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(c){["url","bold","italic","strike","code-snippet"].forEach(function(d){c!==d&&(e.languages.markdown[c].inside.content.inside[d]=e.languages.markdown[d])})}),e.hooks.add("after-tokenize",function(c){c.language!=="markdown"&&c.language!=="md"||function d(h){if(h&&typeof h!="string")for(var f=0,m=h.length;f<m;f++){var p,y=h[f];y.type!=="code"?d(y.content):(p=y.content[1],y=y.content[3],p&&y&&p.type==="code-language"&&y.type==="code-block"&&typeof p.content=="string"&&(p=p.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),p="language-"+(p=(/[a-z][\w-]*/i.exec(p)||[""])[0].toLowerCase()),y.alias?typeof y.alias=="string"?y.alias=[y.alias,p]:y.alias.push(p):y.alias=[p]))}}(c.tokens)}),e.hooks.add("wrap",function(c){if(c.type==="code-block"){for(var d="",h=0,f=c.classes.length;h<f;h++){var m=c.classes[h],m=/language-(.+)/.exec(m);if(m){d=m[1];break}}var p,y=e.languages[d];y?c.content=e.highlight(function(b){return b=b.replace(o,""),b=b.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(_,v){var g;return(v=v.toLowerCase())[0]==="#"?(g=v[1]==="x"?parseInt(v.slice(2),16):Number(v.slice(1)),l(g)):a[v]||_})}(c.content),y,d):d&&d!=="none"&&e.plugins.autoloader&&(p="md-"+new Date().valueOf()+"-"+Math.floor(1e16*Math.random()),c.attributes.id=p,e.plugins.autoloader.loadLanguages(d,function(){var b=document.getElementById(p);b&&(b.innerHTML=e.highlight(b.textContent,e.languages[d],d))}))}}),RegExp(e.languages.markup.tag.pattern.source,"gi")),a={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(U),U.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:U.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},U.hooks.add("after-tokenize",function(e){if(e.language==="graphql")for(var t=e.tokens.filter(function(p){return typeof p!="string"&&p.type!=="comment"&&p.type!=="scalar"}),n=0;n<t.length;){var r=t[n++];if(r.type==="keyword"&&r.content==="mutation"){var i=[];if(h(["definition-mutation","punctuation"])&&d(1).content==="("){n+=2;var s=f(/^\($/,/^\)$/);if(s===-1)continue;for(;n<s;n++){var o=d(0);o.type==="variable"&&(m(o,"variable-input"),i.push(o.content))}n=s+1}if(h(["punctuation","property-query"])&&d(0).content==="{"&&(n++,m(d(0),"property-mutation"),0<i.length)){var a=f(/^\{$/,/^\}$/);if(a!==-1)for(var l=n;l<a;l++){var c=t[l];c.type==="variable"&&0<=i.indexOf(c.content)&&m(c,"variable-input")}}}}function d(p){return t[n+p]}function h(p,y){y=y||0;for(var b=0;b<p.length;b++){var _=d(b+y);if(!_||_.type!==p[b])return}return 1}function f(p,y){for(var b=1,_=n;_<t.length;_++){var v=t[_],g=v.content;if(v.type==="punctuation"&&typeof g=="string"){if(p.test(g))b++;else if(y.test(g)&&--b===0)return _}}return-1}function m(p,y){var b=p.alias;b?Array.isArray(b)||(p.alias=b=[b]):p.alias=b=[],b.push(y)}}),U.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,i=r.inside["interpolation-punctuation"],s=r.pattern.source;function o(h,f){if(e.languages[h])return{pattern:RegExp("((?:"+f+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:h}}}}function a(h,f,m){return h={code:h,grammar:f,language:m},e.hooks.run("before-tokenize",h),h.tokens=e.tokenize(h.code,h.grammar),e.hooks.run("after-tokenize",h),h.tokens}function l(h,f,m){var b=e.tokenize(h,{interpolation:{pattern:RegExp(s),lookbehind:!0}}),p=0,y={},b=a(b.map(function(v){if(typeof v=="string")return v;for(var g,S,v=v.content;h.indexOf((S=p++,g="___"+m.toUpperCase()+"_"+S+"___"))!==-1;);return y[g]=v,g}).join(""),f,m),_=Object.keys(y);return p=0,function v(g){for(var S=0;S<g.length;S++){if(p>=_.length)return;var k,x,T,L,B,j,F,A=g[S];typeof A=="string"||typeof A.content=="string"?(k=_[p],(F=(j=typeof A=="string"?A:A.content).indexOf(k))!==-1&&(++p,x=j.substring(0,F),B=y[k],T=void 0,(L={})["interpolation-punctuation"]=i,(L=e.tokenize(B,L)).length===3&&((T=[1,1]).push.apply(T,a(L[1],e.languages.javascript,"javascript")),L.splice.apply(L,T)),T=new e.Token("interpolation",L,r.alias,B),L=j.substring(F+k.length),B=[],x&&B.push(x),B.push(T),L&&(v(j=[L]),B.push.apply(B,j)),typeof A=="string"?(g.splice.apply(g,[S,1].concat(B)),S+=B.length-1):A.content=B)):(F=A.content,Array.isArray(F)?v(F):v([F]))}}(b),new e.Token(m,b,"language-"+m,h)}e.languages.javascript["template-string"]=[o("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),o("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),o("svg",/\bsvg/.source),o("markdown",/\b(?:markdown|md)/.source),o("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),o("sql",/\bsql/.source),t].filter(Boolean);var c={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function d(h){return typeof h=="string"?h:Array.isArray(h)?h.map(d).join(""):d(h.content)}e.hooks.add("after-tokenize",function(h){h.language in c&&function f(m){for(var p=0,y=m.length;p<y;p++){var b,_,v,g=m[p];typeof g!="string"&&(b=g.content,Array.isArray(b)?g.type==="template-string"?(g=b[1],b.length===3&&typeof g!="string"&&g.type==="embedded-code"&&(_=d(g),g=g.alias,g=Array.isArray(g)?g[0]:g,v=e.languages[g])&&(b[1]=l(_,v,g))):f(b):typeof b!="string"&&f([b]))}}(h.tokens)})}(U),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(U),function(e){var t=e.languages.javascript,n=/\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source,r="(@(?:arg|argument|param|property)\\s+(?:"+n+"\\s+)?)";e.languages.jsdoc=e.languages.extend("javadoclike",{parameter:{pattern:RegExp(r+/(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(r+/\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g,function(){return n})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp("(@[a-z]+\\s+)"+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:"language-javascript"}}}}),e.languages.javadoclike.addSupport("javascript",e.languages.jsdoc)}(U),function(e){e.languages.flow=e.languages.extend("javascript",{}),e.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:"class-name"}]}),e.languages.flow["function-variable"].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(U),U.languages.n4js=U.languages.extend("javascript",{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),U.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),U.languages.n4jsd=U.languages.n4js,function(e){function t(o,a){return RegExp(o.replace(/<ID>/g,function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source}),a)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var s=n[r],i=e.languages.javascript[s],s=(i=e.util.type(i)==="RegExp"?e.languages.javascript[s]={pattern:i}:i).inside||{};(i.inside=s)["maybe-class-name"]=/^[A-Z][\s\S]*/}}(U),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,i=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function s(l,c){return l=l.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(l,c)}i=s(i).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=s(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:s(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:s(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);function o(l){for(var c=[],d=0;d<l.length;d++){var h=l[d],f=!1;typeof h!="string"&&(h.type==="tag"&&h.content[0]&&h.content[0].type==="tag"?h.content[0].content[0].content==="</"?0<c.length&&c[c.length-1].tagName===a(h.content[0].content[1])&&c.pop():h.content[h.content.length-1].content!=="/>"&&c.push({tagName:a(h.content[0].content[1]),openedBraces:0}):0<c.length&&h.type==="punctuation"&&h.content==="{"?c[c.length-1].openedBraces++:0<c.length&&0<c[c.length-1].openedBraces&&h.type==="punctuation"&&h.content==="}"?c[c.length-1].openedBraces--:f=!0),(f||typeof h=="string")&&0<c.length&&c[c.length-1].openedBraces===0&&(f=a(h),d<l.length-1&&(typeof l[d+1]=="string"||l[d+1].type==="plain-text")&&(f+=a(l[d+1]),l.splice(d+1,1)),0<d&&(typeof l[d-1]=="string"||l[d-1].type==="plain-text")&&(f=a(l[d-1])+f,l.splice(d-1,1),d--),l[d]=new e.Token("plain-text",f,null,f)),h.content&&typeof h.content!="string"&&o(h.content)}}var a=function(l){return l?typeof l=="string"?l:typeof l.content=="string"?l.content:l.content.map(a).join(""):""};e.hooks.add("after-tokenize",function(l){l.language!=="jsx"&&l.language!=="tsx"||o(l.tokens)})}(U),function(e){var t=e.util.clone(e.languages.typescript),t=(e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"],e.languages.tsx.tag);t.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+t.pattern.source+")",t.pattern.flags),t.lookbehind=!0}(U),U.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},U.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=U.languages.swift}),function(e){e.languages.kotlin=e.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),e.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(U),U.languages.c=U.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),U.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),U.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},U.languages.c.string],char:U.languages.c.char,comment:U.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:U.languages.c}}}}),U.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete U.languages.c.boolean,U.languages.objectivec=U.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete U.languages.objectivec["class-name"],U.languages.objc=U.languages.objectivec,U.languages.reason=U.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),U.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete U.languages.reason.function,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(U),U.languages.go=U.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),U.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete U.languages.go["class-name"],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(U),U.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},U.languages.python["string-interpolation"].inside.interpolation.inside.rest=U.languages.python,U.languages.py=U.languages.python,U.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},U.languages.webmanifest=U.languages.json;var Ip={};jT(Ip,{dracula:()=>LT,duotoneDark:()=>IT,duotoneLight:()=>OT,github:()=>BT,gruvboxMaterialDark:()=>pD,gruvboxMaterialLight:()=>gD,jettwaveDark:()=>oD,jettwaveLight:()=>lD,nightOwl:()=>$T,nightOwlLight:()=>WT,oceanicNext:()=>VT,okaidia:()=>KT,oneDark:()=>uD,oneLight:()=>dD,palenight:()=>GT,shadesOfPurple:()=>JT,synthwave84:()=>QT,ultramin:()=>tD,vsDark:()=>ES,vsLight:()=>iD});var PT={plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},LT=PT,AT={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},IT=AT,MT={plain:{backgroundColor:"#faf8f5",color:"#728fcb"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#b6ad9a"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#063289"}},{types:["property","function"],style:{color:"#b29762"}},{types:["tag-id","selector","atrule-id"],style:{color:"#2d2006"}},{types:["attr-name"],style:{color:"#896724"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule"],style:{color:"#728fcb"}},{types:["placeholder","variable"],style:{color:"#93abdc"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#896724"}}]},OT=MT,zT={plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},BT=zT,FT={plain:{color:"#d6deeb",backgroundColor:"#011627"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(99, 119, 119)",fontStyle:"italic"}},{types:["string","url"],style:{color:"rgb(173, 219, 103)"}},{types:["variable"],style:{color:"rgb(214, 222, 235)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation"],style:{color:"rgb(199, 146, 234)"}},{types:["selector","doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(255, 203, 139)"}},{types:["tag","operator","keyword"],style:{color:"rgb(127, 219, 202)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["property"],style:{color:"rgb(128, 203, 196)"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}}]},$T=FT,HT={plain:{color:"#403f53",backgroundColor:"#FBFBFB"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(72, 118, 214)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(152, 159, 177)",fontStyle:"italic"}},{types:["string","builtin","char","constant","url"],style:{color:"rgb(72, 118, 214)"}},{types:["variable"],style:{color:"rgb(201, 103, 101)"}},{types:["number"],style:{color:"rgb(170, 9, 130)"}},{types:["punctuation"],style:{color:"rgb(153, 76, 195)"}},{types:["function","selector","doctype"],style:{color:"rgb(153, 76, 195)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(17, 17, 17)"}},{types:["tag"],style:{color:"rgb(153, 76, 195)"}},{types:["operator","property","keyword","namespace"],style:{color:"rgb(12, 150, 155)"}},{types:["boolean"],style:{color:"rgb(188, 84, 84)"}}]},WT=HT,In={char:"#D8DEE9",comment:"#999999",keyword:"#c5a5c5",primitive:"#5a9bcf",string:"#8dc891",variable:"#d7deea",boolean:"#ff8b50",tag:"#fc929e",function:"#79b6f2",className:"#FAC863"},UT={plain:{backgroundColor:"#282c34",color:"#ffffff"},styles:[{types:["attr-name"],style:{color:In.keyword}},{types:["attr-value"],style:{color:In.string}},{types:["comment","block-comment","prolog","doctype","cdata","shebang"],style:{color:In.comment}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:In.primitive}},{types:["boolean"],style:{color:In.boolean}},{types:["tag"],style:{color:In.tag}},{types:["string"],style:{color:In.string}},{types:["punctuation"],style:{color:In.string}},{types:["selector","char","builtin","inserted"],style:{color:In.char}},{types:["function"],style:{color:In.function}},{types:["operator","entity","url","variable"],style:{color:In.variable}},{types:["keyword"],style:{color:In.keyword}},{types:["atrule","class-name"],style:{color:In.className}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}}]},VT=UT,qT={plain:{color:"#f8f8f2",backgroundColor:"#272822"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"#f92672",fontStyle:"italic"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"#8292a2",fontStyle:"italic"}},{types:["string","url"],style:{color:"#a6e22e"}},{types:["variable"],style:{color:"#f8f8f2"}},{types:["number"],style:{color:"#ae81ff"}},{types:["builtin","char","constant","function","class-name"],style:{color:"#e6db74"}},{types:["punctuation"],style:{color:"#f8f8f2"}},{types:["selector","doctype"],style:{color:"#a6e22e",fontStyle:"italic"}},{types:["tag","operator","keyword"],style:{color:"#66d9ef"}},{types:["boolean"],style:{color:"#ae81ff"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)",opacity:.7}},{types:["tag","property"],style:{color:"#f92672"}},{types:["attr-name"],style:{color:"#a6e22e !important"}},{types:["doctype"],style:{color:"#8292a2"}},{types:["rule"],style:{color:"#e6db74"}}]},KT=qT,YT={plain:{color:"#bfc7d5",backgroundColor:"#292d3e"},styles:[{types:["comment"],style:{color:"rgb(105, 112, 152)",fontStyle:"italic"}},{types:["string","inserted"],style:{color:"rgb(195, 232, 141)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation","selector"],style:{color:"rgb(199, 146, 234)"}},{types:["variable"],style:{color:"rgb(191, 199, 213)"}},{types:["class-name","attr-name"],style:{color:"rgb(255, 203, 107)"}},{types:["tag","deleted"],style:{color:"rgb(255, 85, 114)"}},{types:["operator"],style:{color:"rgb(137, 221, 255)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["keyword"],style:{fontStyle:"italic"}},{types:["doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}},{types:["url"],style:{color:"rgb(221, 221, 221)"}}]},GT=YT,XT={plain:{color:"#9EFEFF",backgroundColor:"#2D2A55"},styles:[{types:["changed"],style:{color:"rgb(255, 238, 128)"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)"}},{types:["comment"],style:{color:"rgb(179, 98, 255)",fontStyle:"italic"}},{types:["punctuation"],style:{color:"rgb(255, 255, 255)"}},{types:["constant"],style:{color:"rgb(255, 98, 140)"}},{types:["string","url"],style:{color:"rgb(165, 255, 144)"}},{types:["variable"],style:{color:"rgb(255, 238, 128)"}},{types:["number","boolean"],style:{color:"rgb(255, 98, 140)"}},{types:["attr-name"],style:{color:"rgb(255, 180, 84)"}},{types:["keyword","operator","property","namespace","tag","selector","doctype"],style:{color:"rgb(255, 157, 0)"}},{types:["builtin","char","constant","function","class-name"],style:{color:"rgb(250, 208, 0)"}}]},JT=XT,ZT={plain:{backgroundColor:"linear-gradient(to bottom, #2a2139 75%, #34294f)",backgroundImage:"#34294f",color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#495495",fontStyle:"italic"}},{types:["punctuation"],style:{color:"#ccc"}},{types:["tag","attr-name","namespace","number","unit","hexcode","deleted"],style:{color:"#e2777a"}},{types:["property","selector"],style:{color:"#72f1b8",textShadow:"0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475"}},{types:["function-name"],style:{color:"#6196cc"}},{types:["boolean","selector-id","function"],style:{color:"#fdfdfd",textShadow:"0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975"}},{types:["class-name","maybe-class-name","builtin"],style:{color:"#fff5f6",textShadow:"0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75"}},{types:["constant","symbol"],style:{color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"}},{types:["important","atrule","keyword","selector-class"],style:{color:"#f4eee4",textShadow:"0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575"}},{types:["string","char","attr-value","regex","variable"],style:{color:"#f87c32"}},{types:["parameter"],style:{fontStyle:"italic"}},{types:["entity","url"],style:{color:"#67cdcc"}},{types:["operator"],style:{color:"ffffffee"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["inserted"],style:{color:"green"}}]},QT=ZT,eD={plain:{color:"#282a2e",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(197, 200, 198)"}},{types:["string","number","builtin","variable"],style:{color:"rgb(150, 152, 150)"}},{types:["class-name","function","tag","attr-name"],style:{color:"rgb(40, 42, 46)"}}]},tD=eD,nD={plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},ES=nD,rD={plain:{color:"#000000",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(0, 128, 0)"}},{types:["builtin"],style:{color:"rgb(0, 112, 193)"}},{types:["number","variable","inserted"],style:{color:"rgb(9, 134, 88)"}},{types:["operator"],style:{color:"rgb(0, 0, 0)"}},{types:["constant","char"],style:{color:"rgb(129, 31, 63)"}},{types:["tag"],style:{color:"rgb(128, 0, 0)"}},{types:["attr-name"],style:{color:"rgb(255, 0, 0)"}},{types:["deleted","string"],style:{color:"rgb(163, 21, 21)"}},{types:["changed","punctuation"],style:{color:"rgb(4, 81, 165)"}},{types:["function","keyword"],style:{color:"rgb(0, 0, 255)"}},{types:["class-name"],style:{color:"rgb(38, 127, 153)"}}]},iD=rD,sD={plain:{color:"#f8fafc",backgroundColor:"#011627"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#569CD6"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#f8fafc"}},{types:["attr-name","variable"],style:{color:"#9CDCFE"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#cbd5e1"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#D4D4D4"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#7dd3fc"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},oD=sD,aD={plain:{color:"#0f172a",backgroundColor:"#f1f5f9"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#0c4a6e"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#0f172a"}},{types:["attr-name","variable"],style:{color:"#0c4a6e"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#64748b"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#475569"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#0e7490"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},lD=aD,cD={plain:{backgroundColor:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(220, 10%, 40%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(220, 14%, 71%)"}},{types:["attr-name","class-name","maybe-class-name","boolean","constant","number","atrule"],style:{color:"hsl(29, 54%, 61%)"}},{types:["keyword"],style:{color:"hsl(286, 60%, 67%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(355, 65%, 65%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value"],style:{color:"hsl(95, 38%, 62%)"}},{types:["variable","operator","function"],style:{color:"hsl(207, 82%, 66%)"}},{types:["url"],style:{color:"hsl(187, 47%, 55%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(220, 14%, 71%)"}}]},uD=cD,hD={plain:{backgroundColor:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(230, 4%, 64%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(230, 8%, 24%)"}},{types:["attr-name","class-name","boolean","constant","number","atrule"],style:{color:"hsl(35, 99%, 36%)"}},{types:["keyword"],style:{color:"hsl(301, 63%, 40%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(5, 74%, 59%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value","punctuation"],style:{color:"hsl(119, 34%, 47%)"}},{types:["variable","operator","function"],style:{color:"hsl(221, 87%, 60%)"}},{types:["url"],style:{color:"hsl(198, 99%, 37%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(230, 8%, 24%)"}}]},dD=hD,fD={plain:{color:"#ebdbb2",backgroundColor:"#292828"},styles:[{types:["imports","class-name","maybe-class-name","constant","doctype","builtin","function"],style:{color:"#d8a657"}},{types:["property-access"],style:{color:"#7daea3"}},{types:["tag"],style:{color:"#e78a4e"}},{types:["attr-name","char","url","regex"],style:{color:"#a9b665"}},{types:["attr-value","string"],style:{color:"#89b482"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#ea6962"}},{types:["entity","number","symbol"],style:{color:"#d3869b"}}]},pD=fD,mD={plain:{color:"#654735",backgroundColor:"#f9f5d7"},styles:[{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#af2528"}},{types:["imports","class-name","maybe-class-name","constant","doctype","builtin"],style:{color:"#b4730e"}},{types:["string","attr-value"],style:{color:"#477a5b"}},{types:["property-access"],style:{color:"#266b79"}},{types:["function","attr-name","char","url"],style:{color:"#72761e"}},{types:["tag"],style:{color:"#b94c07"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["entity","number","symbol"],style:{color:"#924f79"}}]},gD=mD,yD=e=>w.useCallback(t=>{var n=t,{className:r,style:i,line:s}=n,o=CS(n,["className","style","line"]);const a=Xc(Tr({},o),{className:ao("token-line",r)});return typeof e=="object"&&"plain"in e&&(a.style=e.plain),typeof i=="object"&&(a.style=Tr(Tr({},a.style||{}),i)),a},[e]),_D=e=>{const t=w.useCallback(({types:n,empty:r})=>{if(e!=null){{if(n.length===1&&n[0]==="plain")return r!=null?{display:"inline-block"}:void 0;if(n.length===1&&r!=null)return e[n[0]]}return Object.assign(r!=null?{display:"inline-block"}:{},...n.map(i=>e[i]))}},[e]);return w.useCallback(n=>{var r=n,{token:i,className:s,style:o}=r,a=CS(r,["token","className","style"]);const l=Xc(Tr({},a),{className:ao("token",...i.types,s),children:i.content,style:t(i)});return o!=null&&(l.style=Tr(Tr({},l.style||{}),o)),l},[t])},vD=/\r\n|\r|\n/,py=e=>{e.length===0?e.push({types:["plain"],content:`
|
|
69
|
+
`,empty:!0}):e.length===1&&e[0].content===""&&(e[0].content=`
|
|
70
|
+
`,e[0].empty=!0)},my=(e,t)=>{const n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},bD=e=>{const t=[[]],n=[e],r=[0],i=[e.length];let s=0,o=0,a=[];const l=[a];for(;o>-1;){for(;(s=r[o]++)<i[o];){let c,d=t[o];const f=n[o][s];if(typeof f=="string"?(d=o>0?d:["plain"],c=f):(d=my(d,f.type),f.alias&&(d=my(d,f.alias)),c=f.content),typeof c!="string"){o++,t.push(d),n.push(c),r.push(0),i.push(c.length);continue}const m=c.split(vD),p=m.length;a.push({types:d,content:m[0]});for(let y=1;y<p;y++)py(a),l.push(a=[]),a.push({types:d,content:m[y]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return py(a),l},gy=bD,wD=({prism:e,code:t,grammar:n,language:r})=>w.useMemo(()=>{if(n==null)return gy([t]);const i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run("before-tokenize",i),i.tokens=e.tokenize(t,n),e.hooks.run("after-tokenize",i),gy(i.tokens)},[t,n,r,e]),SD=(e,t)=>{const{plain:n}=e,r=e.styles.reduce((i,s)=>{const{languages:o,style:a}=s;return o&&!o.includes(t)||s.types.forEach(l=>{const c=Tr(Tr({},i[l]),a);i[l]=c}),i},{});return r.root=n,r.plain=Xc(Tr({},n),{backgroundColor:void 0}),r},xD=SD,kD=({children:e,language:t,code:n,theme:r,prism:i})=>{const s=t.toLowerCase(),o=xD(r,s),a=yD(o),l=_D(o),c=i.languages[s],d=wD({prism:i,language:s,code:n,grammar:c});return e({tokens:d,className:`prism-code language-${s}`,style:o!=null?o.root:{},getLineProps:a,getTokenProps:l})},NS=e=>w.createElement(kD,Xc(Tr({},e),{prism:e.prism||U,theme:e.theme||ES,code:e.code,language:e.language}));/*! Bundled license information:
|
|
71
|
+
|
|
72
|
+
prismjs/prism.js:
|
|
73
|
+
(**
|
|
74
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
75
|
+
*
|
|
76
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
77
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
78
|
+
* @namespace
|
|
79
|
+
* @public
|
|
80
|
+
*)
|
|
81
|
+
*/const CD={sh:"bash",shell:"bash",zsh:"bash",console:"bash",yml:"yaml",md:"markdown",mjs:"javascript",cjs:"javascript",node:"javascript",js:"javascript",ts:"typescript",py:"python",rs:"rust",html:"markup",xml:"markup",txt:"text"};function ED(e){if(!e)return"text";const t=String(e).toLowerCase();return CD[t]||t}function ND({code:e,language:t}){const[n,r]=w.useState(!1),i=ED(t),s=w.useCallback(()=>{var o;try{(o=navigator.clipboard)==null||o.writeText(e),r(!0),setTimeout(()=>r(!1),1400)}catch{}},[e]);return u.jsxs("div",{className:"code-block","data-testid":"code-block",children:[u.jsxs("div",{className:"code-block-head",children:[u.jsx("span",{className:"code-lang",children:i==="text"?"code":i}),u.jsx("button",{className:"code-copy",onClick:s,title:"Copy to clipboard",children:n?"✓ copied":"Copy"})]}),u.jsx(NS,{theme:Ip.vsDark,code:e,language:i,children:({tokens:o,getLineProps:a,getTokenProps:l})=>u.jsx("pre",{className:"code-block-body",children:o.map((c,d)=>u.jsx("div",{...a({line:c}),children:c.map((h,f)=>u.jsx("span",{...l({token:h})},f))},d))})})]})}const jD={pre({children:e}){const t=Array.isArray(e)?e[0]:e,n=(t==null?void 0:t.props)||{},r=/language-([\w-]+)/.exec(n.className||""),i=n.children,s=(Array.isArray(i)?i.join(""):String(i??"")).replace(/\n+$/,"");return u.jsx(ND,{code:s,language:r?r[1]:""})},code({children:e}){return u.jsx("code",{className:"md-code-inline",children:e})},a({href:e,children:t}){return u.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t})},table({children:e}){return u.jsx("div",{className:"md-table-wrap",children:u.jsx("table",{children:e})})}};function RD({text:e}){return u.jsx("div",{className:"markdown",children:u.jsx(lj,{remarkPlugins:[wT],components:jD,children:e||""})})}const jS=w.memo(RD);class TD{diff(t,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(t,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(t,n,r,i){var s;const o=v=>{if(v=this.postProcess(v,r),i){setTimeout(function(){i(v)},0);return}else return v},a=n.length,l=t.length;let c=1,d=a+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+h,m=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(m[0],n,t,0,r);if(m[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(m[0].lastComponent,n,t));let y=-1/0,b=1/0;const _=()=>{for(let v=Math.max(y,-c);v<=Math.min(b,c);v+=2){let g;const S=m[v-1],k=m[v+1];S&&(m[v-1]=void 0);let x=!1;if(k){const L=k.oldPos-v;x=k&&0<=L&&L<a}const T=S&&S.oldPos+1<l;if(!x&&!T){m[v]=void 0;continue}if(!T||x&&S.oldPos<k.oldPos?g=this.addToPath(k,!0,!1,0,r):g=this.addToPath(S,!1,!0,1,r),p=this.extractCommon(g,n,t,v,r),g.oldPos+1>=l&&p+1>=a)return o(this.buildValues(g.lastComponent,n,t))||!0;m[v]=g,g.oldPos+1>=l&&(b=Math.min(b,v-1)),p+1>=a&&(y=Math.max(y,v+1))}c++};if(i)(function v(){setTimeout(function(){if(c>d||Date.now()>f)return i(void 0);_()||v()},0)})();else for(;c<=d&&Date.now()<=f;){const v=_();if(v)return v}}addToPath(t,n,r,i,s){const o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(t,n,r,i,s){const o=n.length,a=r.length;let l=t.oldPos,c=l-i,d=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=l,c}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const i=[];let s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const d=i[a];if(d.removed)d.value=this.join(r.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(l,l+d.count);h=h.map(function(f,m){const p=r[c+m];return p.length>f.length?p:f}),d.value=this.join(h)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}}class DD extends TD{constructor(){super(...arguments),this.tokenize=AD}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
82
|
+
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
83
|
+
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
84
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
85
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const PD=new DD;function LD(e,t,n){return PD.diff(e,t,n)}function AD(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
86
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function ID(e,t){const n=LD(e??"",t??""),r=[];for(const i of n){const s=i.added?"add":i.removed?"del":"ctx",o=i.value.split(`
|
|
87
|
+
`);o.length>1&&o[o.length-1]===""&&o.pop();for(const a of o)r.push({type:s,text:a})}return r}const MD={add:"+",del:"−",ctx:" "};function Pl({oldText:e,newText:t,maxRows:n=80}){const r=ID(e,t),i=r.reduce((a,l)=>a+(l.type==="add"?1:0),0),s=r.reduce((a,l)=>a+(l.type==="del"?1:0),0),o=r.slice(0,n);return u.jsxs("div",{className:"diff-view","data-testid":"diff-view",children:[u.jsxs("div",{className:"diff-stat",children:[u.jsxs("span",{className:"diff-stat-add",children:["+",i]}),u.jsxs("span",{className:"diff-stat-del",children:["−",s]})]}),u.jsx("pre",{className:"diff-body",children:o.map((a,l)=>u.jsxs("div",{className:`diff-line ${a.type}`,children:[u.jsx("span",{className:"diff-gutter",children:MD[a.type]}),u.jsx("span",{className:"diff-text",children:a.text===""?" ":a.text})]},l))}),r.length>n&&u.jsxs("div",{className:"diff-more",children:["+",r.length-n," more lines"]})]})}function yy(e){if(!e)return"";const t=String(e).split(/[\\/]+/).filter(Boolean);return t.length>2?"…/"+t.slice(-2).join("/"):t.join("/")}function OD(e){if(!e||typeof e!="object")return"";for(const t of Object.values(e))if(typeof t=="string"&&t)return t;return""}const zD={Read:{icon:"📄",verb:"Read"},Edit:{icon:"✏️",verb:"Edit"},MultiEdit:{icon:"✏️",verb:"Edit"},Write:{icon:"📝",verb:"Write"},NotebookEdit:{icon:"📓",verb:"Edit notebook"},Bash:{icon:"▶",verb:"Run"},PowerShell:{icon:"▶",verb:"Run"},Glob:{icon:"🔍",verb:"Find"},Grep:{icon:"🔍",verb:"Search"},Task:{icon:"🤖",verb:"Agent"},WebFetch:{icon:"🌐",verb:"Fetch"},WebSearch:{icon:"🌐",verb:"Web search"},Skill:{icon:"✨",verb:"Skill"},TodoWrite:{icon:"☑",verb:"Plan"}};function BD(e,t){if(!t)return"";switch(e){case"Read":case"Edit":case"MultiEdit":case"Write":return yy(t.file_path);case"NotebookEdit":return yy(t.notebook_path);case"Bash":case"PowerShell":return t.command||"";case"Glob":case"Grep":return t.pattern||"";case"Task":return t.description||t.subagent_type||"";case"WebFetch":return t.url||"";case"WebSearch":return t.query||"";case"Skill":return t.command||t.name||"";default:return OD(t)}}function FD({name:e,input:t}){return(t==null?void 0:t._raw)!=null?u.jsx("pre",{className:"tool-raw",children:String(t._raw)}):e==="Edit"?u.jsx(Pl,{oldText:t.old_string||"",newText:t.new_string||""}):e==="MultiEdit"&&Array.isArray(t.edits)?u.jsx(u.Fragment,{children:t.edits.map((n,r)=>u.jsx(Pl,{oldText:n.old_string||"",newText:n.new_string||""},r))}):e==="Write"?u.jsx(Pl,{oldText:"",newText:t.content||""}):(e==="Bash"||e==="PowerShell")&&t.description?u.jsx("div",{className:"tool-desc",children:t.description}):null}function $D({content:e,isError:t}){if(e==null)return null;const n=String(e);if(!n.trim()&&!t)return null;const i=n.length>4e3?n.slice(0,4e3)+`
|
|
88
|
+
… (truncated)`:n,s=n.split(`
|
|
89
|
+
`).find(o=>o.trim())||(t?"error":"done");return u.jsxs("details",{className:`tool-result ${t?"err":""}`,open:t,children:[u.jsxs("summary",{children:[t?"✗ ":"",s.slice(0,140)]}),u.jsx("pre",{children:i})]})}function HD({block:e}){const{name:t,input:n={},result:r,done:i,isError:s}=e,o=zD[t]||{icon:"⚙",verb:t},a=BD(t,n),l=i?s?"error":"done":"running";return u.jsxs("div",{className:`tool-card ${l}`,"data-testid":"tool-card","data-tool":t,children:[u.jsxs("div",{className:"tool-head",children:[u.jsx("span",{className:"tool-icon",children:o.icon}),u.jsx("span",{className:"tool-verb",children:o.verb}),a&&u.jsx("code",{className:"tool-target",children:a}),t==="Edit"&&n.replace_all&&u.jsx("span",{className:"tool-tag",children:"all"}),u.jsx("span",{className:"tool-status","data-status":l,children:l==="running"?u.jsx("span",{className:"tool-spinner","aria-label":"running"}):l==="error"?"✗":"✓"})]}),u.jsx(FD,{name:t,input:n}),u.jsx($D,{content:r,isError:s})]})}function RS(e={}){var s,o;const t=(s=e.vetting)==null?void 0:s.verdict;let n,r;if(t==="auto"||t==="reviewed")n="Verified",r="ok";else if(t==="scanned")n="Scanned",r="ok";else if(t==="flagged")n="Flagged",r="warn";else if(t==="unscanned"||t==="unvetted")n="New",r="neutral";else{const a=e.safetyBadge;a==="verified"?(n="Verified",r="ok"):a==="tested"?(n="Tested",r="ok"):(n="New",r="neutral")}const i=((o=e.attestation)==null?void 0:o.privacy)==="not-attested"?"This producer hasn't confirmed how it handles your data's privacy.":null;return{label:n,tone:r,note:i}}function _y(e={}){const t=Array.isArray(e.builtFrom)?e.builtFrom[0]:null;return(t==null?void 0:t.note)||null}function TS(e){return`$${(Number(e)||0).toFixed(2)}`}const Mp=()=>u.jsx("span",{className:"bz-represented",title:"No real money moves yet — this is a preview of how earnings would work.",children:"represented · settles later"});function WD({block:e,bazaarState:t,canReply:n,onQuickReply:r}){var l;const{tool:i,phase:s,data:o}=e;if(s!=="result")return u.jsx(qD,{tool:i,input:e.input});if(!o||o.kind==="error")return null;switch(i){case"search_shelf":return u.jsx(KD,{data:o});case"open_recipe":return u.jsx(YD,{data:o});case"launch_preview":return u.jsx(GD,{data:o});case"record_use":return u.jsxs(u.Fragment,{children:[((l=o.recipe)==null?void 0:l.riskClass)==="C"&&u.jsx(XD,{recipe:o.recipe}),u.jsx(JD,{data:o,bazaarState:t})]});case"publish_listing":case"publish_draft":return u.jsx(ZD,{data:o});case"draft_recipe":return u.jsx(QD,{data:o,canReply:n,onQuickReply:r});default:return null}}const UD={search_shelf:"Searching the bazaar shelf",open_recipe:"Absorbing the recipe",launch_preview:"Opening your live preview",record_use:"Recording the build",publish_listing:"Packaging for the shelf",draft_recipe:"Drafting a recipe from your work",publish_draft:"Publishing to the shelf"},VD={search_shelf:"🛒",open_recipe:"📖",launch_preview:"▶️",record_use:"🧾",publish_listing:"📦",draft_recipe:"📝",publish_draft:"📦"};function qD({tool:e,input:t}){return u.jsxs("div",{className:"bazaar-card bz-call","data-testid":`bazaar-${e}-call`,children:[u.jsx("span",{className:"bz-icon",children:VD[e]||"🛍️"}),u.jsxs("span",{className:"bz-call-label",children:[UD[e]||"Bazaar","…"]}),e==="search_shelf"&&(t==null?void 0:t.need)&&u.jsxs("span",{className:"bz-call-need",children:["“",t.need,"”"]}),u.jsxs("span",{className:"bz-dots",children:[u.jsx("i",{}),u.jsx("i",{}),u.jsx("i",{})]})]})}function vy(e){return`${Math.round((Number(e)||0)*100)}%`}function KD({data:e}){var r;const t=e.hits||[];if(!t.length)return u.jsxs("div",{className:"bazaar-card bz-empty","data-testid":"bazaar-search-result",children:[u.jsx("span",{className:"bz-icon",children:"🛒"}),u.jsx("span",{children:"Checked the shelf — nothing proven fit this one, so I'll build it from scratch."})]});const n=t[0];return u.jsxs("div",{className:"bazaar-card bz-search","data-testid":"bazaar-search-result",children:[u.jsxs("div",{className:"bz-head",children:[u.jsx("span",{className:"bz-icon",children:"🛒"}),u.jsx("span",{className:"bz-head-title",children:"Found a proven recipe on the shelf"})]}),u.jsxs("div",{className:"bz-hit bz-hit-top",children:[u.jsxs("div",{className:"bz-hit-main",children:[u.jsx("span",{className:"bz-hit-title",children:n.title}),u.jsxs("span",{className:"bz-hit-by",children:["by ",((r=n.producer)==null?void 0:r.name)||"a producer"]})]}),u.jsxs("div",{className:"bz-outcome",title:"How often this recipe actually gets people a working result",children:[u.jsx("strong",{children:vy(n.outcomeScore)})," of builds worked"]})]}),n.pitch&&u.jsx("p",{className:"bz-hit-pitch",children:n.pitch}),t.length>1&&u.jsxs("div",{className:"bz-others",children:["also on the shelf:"," ",t.slice(1,3).map((i,s)=>u.jsxs("span",{children:[s>0&&" · ",i.title," (",vy(i.outcomeScore),")"]},i.id))]})]})}function YD({data:e}){var n;const t=e.card||{};return u.jsxs("div",{className:"bazaar-card bz-recipe","data-testid":"bazaar-recipe",children:[u.jsx("span",{className:"bz-icon",children:"📖"}),u.jsxs("span",{className:"bz-recipe-text",children:["Absorbed ",u.jsx("strong",{children:t.title})," — ",((n=t.producer)==null?void 0:n.name)||"the producer","'s know-how",(()=>{const r=RS(t);return u.jsx("span",{className:`bz-badge bz-trust-${r.tone}`,title:r.note||void 0,children:r.label})})()]})]})}function GD({data:e}){return u.jsxs("div",{className:"bazaar-card bz-preview","data-testid":"bazaar-preview",children:[u.jsx("span",{className:"bz-icon",children:"▶️"}),u.jsx("span",{children:"Your live preview is open — try it on the right."})]})}function XD({recipe:e}){var c,d;const t=e.dataTouched||{},n=e.attestation||{},r=((c=e.vetting)==null?void 0:c.stakes)==="high",i=((d=e.producer)==null?void 0:d.name)||"a connected service",s=t.egress||[],o=t.paid||{},a=o.model&&o.model!=="none",l=n.privacy==="not-attested";return u.jsxs("div",{className:`bazaar-card bz-receipt${r?" bz-receipt-high":""}`,"data-testid":"bazaar-receipt",children:[u.jsxs("div",{className:"bz-receipt-head",children:[u.jsx("span",{className:"bz-icon",children:r?"⚠️":"🔌"}),u.jsx("span",{className:"bz-receipt-title",children:r?`Heads up before ${i} goes live`:`Now using ${i} — here's what that means`})]}),u.jsxs("ul",{className:"bz-receipt-lines",children:[s.length>0&&u.jsxs("li",{"data-testid":"bazaar-receipt-egress",children:[u.jsx("strong",{children:"Leaves your machine:"})," ",s.join(", ")," — sent to ",i,"."]}),a&&u.jsxs("li",{children:[u.jsx("strong",{children:"Cost:"})," ",o.note||o.model,". ",u.jsx(Mp,{})]}),u.jsxs("li",{"data-testid":"bazaar-receipt-privacy",className:l?"bz-receipt-warn":"",children:[u.jsx("strong",{children:"Privacy:"})," ",l?`${i} hasn't confirmed how it handles your data's privacy.`:`${i} has attested how it handles your data.`]}),u.jsx("li",{className:"bz-receipt-foot",children:"You can switch this off anytime — review it later in one place."})]}),r&&u.jsx("div",{className:"bz-receipt-confirm","data-testid":"bazaar-receipt-confirm",children:"This service moves money or takes a real-world action — make sure you're happy before it runs."})]})}function JD({data:e,bazaarState:t}){var c;const n=e.threeWay||{},r=(c=e.recipe)==null?void 0:c.producer,i=e.credit||{},s=((t==null?void 0:t.earnings)||[]).find(d=>d.handle===(r==null?void 0:r.handle)),o=(s==null?void 0:s.total)??i.oneTime??0,a=(s==null?void 0:s.matches)??0,l=!!e.service;return u.jsxs("div",{className:"bazaar-card bz-threeway","data-testid":"bazaar-threeway",children:[u.jsxs("div",{className:"bz-tw-head",children:[u.jsx("span",{className:"bz-tw-spark",children:"✦"})," Everyone just won"]}),u.jsxs("div",{className:"bz-tw-cols",children:[u.jsxs("div",{className:"bz-tw-col bz-tw-you",children:[u.jsx("div",{className:"bz-tw-who",children:"👤 You"}),u.jsx("div",{className:"bz-tw-what",children:n.you})]}),u.jsxs("div",{className:"bz-tw-col bz-tw-producer",children:[u.jsxs("div",{className:"bz-tw-who",children:["🏷️ ",(r==null?void 0:r.name)||"The producer"]}),u.jsx("div",{className:"bz-tw-what",children:n.producer}),u.jsxs("div",{className:"bz-tw-meter","data-testid":"bazaar-meter",children:[u.jsx("span",{className:"bz-meter-amount",children:TS(o)}),u.jsx("span",{className:"bz-meter-sub",children:l?`${a} ${a===1?"match":"matches"} so far`:"one-time"})]}),u.jsx(Mp,{})]}),u.jsxs("div",{className:"bz-tw-col bz-tw-vw",children:[u.jsx("div",{className:"bz-tw-who",children:"🟣 VentureWild"}),u.jsx("div",{className:"bz-tw-what",children:n.platform})]})]})]})}function ZD({data:e}){const t=e.listing||{},n=e.earning||{};return u.jsxs("div",{className:"bazaar-card bz-publish","data-testid":"bazaar-publish",children:[u.jsxs("div",{className:"bz-head",children:[u.jsx("span",{className:"bz-icon",children:"📦"}),u.jsx("span",{className:"bz-head-title",children:"You're a producer now"})]}),u.jsxs("p",{className:"bz-publish-text",children:[u.jsx("strong",{children:t.title})," is on the shelf. You'll earn when other people build on it."]}),u.jsxs("div",{className:"bz-tw-meter",children:[u.jsx("span",{className:"bz-meter-amount",children:TS(n.oneTimeValue)}),u.jsxs("span",{className:"bz-meter-sub",children:["per build · ",u.jsx(Mp,{})]})]})]})}function QD({data:e,canReply:t,onQuickReply:n}){var i;const r=e.draft||{};return u.jsxs("div",{className:"bazaar-card bz-draft","data-testid":"bazaar-draft",children:[u.jsxs("div",{className:"bz-head",children:[u.jsx("span",{className:"bz-icon",children:"📝"}),u.jsx("span",{className:"bz-head-title",children:"Draft recipe — review before it goes on the shelf"})]}),u.jsx("div",{className:"bz-hit-main",children:u.jsx("span",{className:"bz-hit-title",children:r.title})}),r.pitch&&u.jsx("p",{className:"bz-hit-pitch",children:r.pitch}),r.sourceNote&&u.jsxs("div",{className:"bz-draft-source",children:["Generalized from: ",r.sourceNote]}),((i=r.tags)==null?void 0:i.length)>0&&u.jsx("div",{className:"bz-others",children:r.tags.slice(0,8).join(" · ")}),r.knowHow&&u.jsxs("details",{className:"bz-draft-knowhow",children:[u.jsx("summary",{children:"Preview the know-how — check it for any client specifics"}),u.jsx("pre",{children:r.knowHow})]}),n?u.jsxs("div",{className:"bz-draft-actions",children:[u.jsx("button",{type:"button",className:"bz-build-btn",disabled:!t,"data-testid":"bazaar-draft-publish",onClick:()=>t&&n(`Publish the “${r.title}” draft to my shelf.`),children:"Publish to my shelf →"}),u.jsx("button",{type:"button",className:"bz-draft-skip",disabled:!t,"data-testid":"bazaar-draft-skip",onClick:()=>t&&n(`Skip the “${r.title}” draft — don't publish that one.`),children:"Skip this one"}),u.jsx("span",{className:"bz-draft-hint",children:"Nothing's published until you choose."})]}):u.jsx("div",{className:"bz-draft-hint",children:"Nothing's published yet — tell me which drafts to put on your shelf."})]})}const gs=[{who:"Two HR people",occ:"recruiting team",built:"an AI platform that matches candidates to roles — no engineers on the team"},{who:"A freight-forwarding team",occ:"logistics",built:"an analytics brain that answers plain-language questions about their shipments"},{who:"A game-studio founder",occ:"games",built:"a world of AI agents that play and learn together"},{who:"A solo consultant",occ:"business consulting",built:"turned a year of client work into a product — this one"}],eP="Most of the people building here have never written a line of code.",tP=4200;function nP(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Jc({variant:e="ambient"}){const t=e==="ambient"&&gs.length>1&&!nP(),[n,r]=w.useState(()=>Math.floor(Math.random()*gs.length));w.useEffect(()=>{if(!t)return;const s=setInterval(()=>r(o=>(o+1)%gs.length),tP);return()=>clearInterval(s)},[t]);const i=e==="block"?gs:[gs[n%gs.length]];return u.jsxs("div",{className:`peer-stream peer-stream-${e}`,"data-testid":"peer-stream",children:[i.map((s,o)=>u.jsxs("div",{className:"peer-item",children:[u.jsxs("span",{className:"peer-who",children:[s.who,s.occ?u.jsxs("span",{className:"peer-occ",children:[" · ",s.occ]}):null]}),u.jsx("span",{className:"peer-built",children:s.quote?`“${s.quote}”`:s.built})]},`${s.who}-${o}-${e==="ambient"?n:"all"}`)),u.jsx("p",{className:"peer-honest",children:eP})]})}const yc="wild-workspace.chat.v2";function Ju({id:e,isDefault:t}={},n){const r=t||!e?yc:`${yc}:${e}`;return n?`${r}:${n}`:r}function rP({messageId:e,userText:t,agentText:n}={}){return!e||!t||!n?[]:[{id:`u-${e}`,role:"user",text:t},{id:e,role:"agent",blocks:[{type:"text",text:n}]}]}function iP(e,t=globalThis.localStorage,n=yc){const r=rP(e);if(!r.length||!t)return!1;try{const i=t.getItem(n),s=i?JSON.parse(i):[];return Array.isArray(s)&&s.length>0?!1:(t.setItem(n,JSON.stringify(r)),!0)}catch{return!1}}const Td="wild:workspace:id";let Vs=null;try{Vs=typeof sessionStorage<"u"&&sessionStorage.getItem(Td)||null}catch{Vs=null}function Is(){return Vs}function sP(e){Vs=e||null;try{Vs?sessionStorage.setItem(Td,Vs):sessionStorage.removeItem(Td)}catch{}}function oP(e,t){var i;const n=e.blocks?e.blocks.slice():[],r=n[n.length-1];switch(t.type){case"text":return r&&r.type==="text"?n[n.length-1]={...r,text:r.text+t.text}:n.push({type:"text",text:t.text}),{...e,blocks:n};case"thinking":return r&&r.type==="thinking"?n[n.length-1]={...r,text:r.text+t.text}:n.push({type:"thinking",text:t.text}),{...e,blocks:n};case"tool-use":return n.push({type:"tool",id:t.id,name:t.name,input:t.input||{},done:!1}),{...e,blocks:n};case"tool-result":{const s=n.findIndex(o=>o.type==="tool"&&o.id===t.id);return s>=0&&(n[s]={...n[s],result:t.content,isError:t.isError,done:!0}),{...e,blocks:n}}case"usage":return{...e,usage:t.usage,costUsd:(i=t.usage)==null?void 0:i.cost_usd,durationMs:t.durationMs};case"error":return n.push({type:"error",text:t.message||"agent error"}),{...e,blocks:n};case"bazaar":{if(t.phase==="call")return n.push({type:"bazaar",id:t.id,tool:t.tool,phase:"call",input:t.input||{}}),{...e,blocks:n};if(t.phase==="result"){const s=n.findIndex(o=>o.type==="bazaar"&&o.id===t.id);return s>=0?n[s]={...n[s],phase:"result",data:t.data,isError:t.isError}:n.push({type:"bazaar",id:t.id,tool:t.tool,phase:"result",data:t.data}),{...e,blocks:n}}return e}case"canvas":{if(t.phase==="call")return n.push({type:"canvas",id:t.id,tool:t.tool,phase:"call"}),{...e,blocks:n};if(t.phase==="result"){const s=n.findIndex(a=>a.type==="canvas"&&a.id===t.id),o={type:"canvas",id:t.id,tool:t.tool,phase:"result",data:t.data,isError:t.isError};return s>=0?n[s]={...n[s],...o}:n.push(o),{...e,blocks:n}}return e}default:return e}}function by(e,t,n){const r=e.findIndex(s=>s.id===t);if(r<0)return e;const i=e.slice();return i[r]=oP(i[r],n),i}function aP(e,t,n){if(!n||!n.trim())return e;const r=e.findIndex(s=>s.id===t);if(r<0)return e;const i=e.slice();return i[r]={...i[r],stderr:(i[r].stderr||"")+n},i}function lP({role:e,capabilities:t,mode:n,token:r,onBazaarEvent:i,inject:s,agentName:o,storageKey:a,threadId:l}){const c=a||yc,[d,h]=w.useState(()=>{try{const I=localStorage.getItem(c);if(I)return JSON.parse(I)}catch{}return[]}),[f,m]=w.useState(null),[p,y]=w.useState(!1),[b,_]=w.useState(""),[v,g]=w.useState(!1),[S,k]=w.useState(null),x=w.useRef(null),T=w.useRef(null),L=w.useRef(!0),B=w.useRef(i),j=w.useRef(null),F=w.useRef(null),A=w.useRef(null);w.useEffect(()=>{B.current=i},[i]),w.useEffect(()=>{try{localStorage.setItem(c,JSON.stringify(d.slice(-120)))}catch{}},[d]),w.useEffect(()=>{const I=T.current;I&&L.current&&(I.scrollTop=I.scrollHeight)},[d]);function R(){const I=T.current;I&&(L.current=I.scrollHeight-I.scrollTop-I.clientHeight<90)}w.useEffect(()=>{let I=!1,C=0,X=null,ie=null;const E=()=>{if(I)return;const ue=window.location.protocol==="https:"?"wss":"ws",ve=new URL(`${ue}://${window.location.host}/ws/chat`);r&&ve.searchParams.set("t",r);const Z=Is();Z&&ve.searchParams.set("workspace",Z),l&&ve.searchParams.set("thread",l),ie=new WebSocket(ve.toString()),x.current=ie,ie.onopen=()=>{C=0,g(!0)},ie.onmessage=pe=>{var ge,Pe,we,Be,be,Ue,M,ae,re,Ee;let ce;try{ce=JSON.parse(pe.data)}catch{return}if(!(ce.threadId&&ce.threadId!==l)){if(ce.type==="chunk"){const G=ce.chunk;if(h(se=>by(se,ce.messageId,G)),(G==null?void 0:G.type)==="bazaar"&&G.phase==="result"&&!G.isError){const se=G.data||{};if(G.tool==="launch_preview"||G.tool==="record_use"&&se.preview){const ke=se.url||((ge=se.preview)==null?void 0:ge.url)||"/preview/";(Pe=B.current)==null||Pe.call(B,{type:"preview",url:ke,ts:Date.now()}),j.current=ke}}(G==null?void 0:G.type)==="canvas"&&G.phase==="result"&&!G.isError&&((we=G.data)==null?void 0:we.kind)==="block"&&G.data.block&&((Be=B.current)==null||Be.call(B,{type:"block",op:G.data.op||"make",block:G.data.block})),(G==null?void 0:G.type)==="canvas"&&G.phase==="result"&&!G.isError&&((be=G.data)==null?void 0:be.kind)==="theme"&&G.data.op==="set"&&G.data.theme&&((Ue=B.current)==null||Ue.call(B,{type:"theme",theme:G.data.theme})),(G==null?void 0:G.type)==="bazaar"&&G.phase==="result"&&!G.isError&&((M=G.data)==null?void 0:M.kind)==="theme-applied"&&G.data.theme&&((ae=B.current)==null||ae.call(B,{type:"theme",theme:G.data.theme}))}else if(ce.type==="bazaar")ce.phase==="meter"&&(k(ce.state),(re=B.current)==null||re.call(B,{type:"meter",state:ce.state}));else if(ce.type==="usage")(Ee=B.current)==null||Ee.call(B,{type:"usage",state:ce.state});else if(ce.type==="stderr")h(G=>aP(G,ce.messageId,ce.text));else if(ce.type==="end"){if(m(null),y(!1),j.current){let G=j.current;j.current=null;try{G=new URL(G,window.location.origin).href}catch{}h(se=>[...se,{id:`win-${Date.now()}`,role:"win",url:G}])}}else if(ce.type==="error")m(null),y(!1),j.current=null,ce.messageId?h(G=>by(G,ce.messageId,{type:"error",message:ce.message||"agent error"})):h(G=>[...G,{id:`err-${Date.now()}`,role:"error",text:ce.message||"agent error"}]);else if(ce.type==="turn-begin")j.current=null,h(G=>{if(G.some(ke=>ke.id===ce.messageId))return G;const se=[];return ce.userText&&se.push({id:`u-${ce.messageId}`,role:"user",text:ce.userText}),ce.note&&se.push({id:`note-${ce.messageId}`,role:"system",text:ce.note}),se.push({id:ce.messageId,role:"agent",blocks:[]}),[...G,...se]}),m(ce.messageId),y(!0);else if(ce.type==="reset"){h([]),m(null),y(!1),j.current=null;try{localStorage.removeItem(c)}catch{}}}},ie.onerror=()=>y(!1),ie.onclose=()=>{if(g(!1),y(!1),m(null),I)return;const pe=Math.min(1e3*2**C,1e4);C+=1,X=setTimeout(E,pe)}};return E(),()=>{I=!0,clearTimeout(X);try{ie==null||ie.close()}catch{}}},[r,l]);function P(I,C){if(!t.chatWrite)return;const X=(typeof I=="string"?I:b).trim();if(!X||p)return;const ie=typeof C=="string"&&C.trim()||X,E=x.current,ue=E==null?void 0:E.readyState;if(!E||ue!==WebSocket.OPEN&&ue!==WebSocket.CONNECTING){h(pe=>[...pe,{id:`err-${Date.now()}`,role:"error",text:"reconnecting to your agent — try again in a few seconds"}]);return}const ve=`m-${Date.now()}`;L.current=!0,h(pe=>[...pe,{id:`u-${ve}`,role:"user",text:ie},{id:ve,role:"agent",blocks:[]}]),m(ve),y(!0),_("");const Z=JSON.stringify({type:"send",text:X,mode:n,messageId:ve,...l?{threadId:l}:{}});ue===WebSocket.OPEN?E.send(Z):E.addEventListener("open",()=>{try{E.send(Z)}catch{}},{once:!0})}F.current=P,w.useEffect(()=>{var I;!(s!=null&&s.text)||A.current===s.ts||(A.current=s.ts,L.current=!0,(I=F.current)==null||I.call(F,s.text))},[s]);function N(){var I;((I=x.current)==null?void 0:I.readyState)===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"cancel",...l?{threadId:l}:{}})),y(!1),m(null)}function O(){var I;((I=x.current)==null?void 0:I.readyState)===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"reset",...l?{threadId:l}:{}})),h([]),m(null),y(!1),j.current=null;try{localStorage.removeItem(c)}catch{}}function W(I){I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P())}const D=d.length===0;return u.jsxs(u.Fragment,{children:[!D&&t.chatWrite&&u.jsx("div",{className:"chat-toolbar","data-testid":"chat-toolbar",children:u.jsx("button",{className:"chat-newbtn",onClick:O,disabled:p,"data-testid":"new-chat-btn",title:"Start a fresh conversation — the agent forgets the current thread",children:"+ New chat"})}),u.jsxs("div",{className:"chat-messages",ref:T,onScroll:R,"data-testid":"chat-messages",children:[D&&u.jsx(yP,{role:e,connected:v,agentName:o,canSend:t.chatWrite&&!p,onSend:P}),d.map(I=>u.jsx(cP,{message:I,streaming:I.id===f,bazaarState:S,canReply:t.chatWrite&&!p,onQuickReply:P},I.id))]}),t.chatWrite&&u.jsxs("div",{className:"chat-input","data-testid":"chat-input",children:[u.jsx("textarea",{"data-testid":"chat-textarea",placeholder:e==="client"?"Describe the change you’d like…":"Ask the agent to build, fix, or explain something — Enter to send",value:b,onChange:I=>_(I.target.value),onKeyDown:W,disabled:p,rows:2}),p?u.jsx("button",{onClick:N,"data-testid":"cancel-btn",children:"Stop"}):u.jsx("button",{className:"primary send-btn",onClick:P,disabled:!b.trim(),"data-testid":"send-btn",children:"Send"})]}),!t.chatWrite&&e==="viewer"&&u.jsx("div",{className:"chat-readonly-banner",children:"You’re viewing a shared workspace (read-only)."})]})}function cP({message:e,streaming:t,bazaarState:n,canReply:r,onQuickReply:i}){if(e.role==="user")return u.jsx("div",{className:"chat-msg user","data-testid":"chat-msg-user",children:u.jsx("div",{className:"msg-plain",children:e.text})});if(e.role==="system")return u.jsx("div",{className:"chat-msg system","data-testid":"chat-msg-system",children:e.text});if(e.role==="win")return u.jsx(pP,{url:e.url});if(e.role==="error")return u.jsxs("div",{className:"chat-msg error","data-testid":"chat-msg-error",children:["⚠ ",e.text]});const s=e.blocks||[],o=s[s.length-1],a=t&&(o==null?void 0:o.type)==="text"?s.length-1:-1,l=t&&(s.length===0||(o==null?void 0:o.type)==="tool"&&o.done);return u.jsxs("div",{className:"chat-msg agent","data-testid":"chat-msg-agent",children:[s.map((c,d)=>u.jsx(uP,{block:c,cursor:d===a,bazaarState:n,canReply:r,onQuickReply:i},c.id||`${c.type}-${d}`)),l&&u.jsx(mP,{}),e.usage&&u.jsx(gP,{usage:e.usage,costUsd:e.costUsd,durationMs:e.durationMs}),e.stderr&&u.jsxs("details",{className:"stderr-block",children:[u.jsx("summary",{children:"stderr"}),u.jsx("pre",{children:e.stderr})]})]})}function uP({block:e,cursor:t,bazaarState:n,canReply:r,onQuickReply:i}){var s;return e.type==="bazaar"?u.jsx(WD,{block:e,bazaarState:n,canReply:r,onQuickReply:i}):e.type==="text"?u.jsxs("div",{className:"agent-text",children:[u.jsx(jS,{text:e.text}),t&&u.jsx("span",{className:"stream-cursor"})]}):e.type==="thinking"?u.jsxs("details",{className:"thinking-block",children:[u.jsx("summary",{children:"💭 Thought process"}),u.jsx("div",{className:"thinking-body",children:e.text})]}):e.type==="tool"?e.name==="AskUserQuestion"&&Array.isArray((s=e.input)==null?void 0:s.questions)&&e.input.questions.length?u.jsx(dP,{block:e,canReply:r,onQuickReply:i}):u.jsx(HD,{block:e}):e.type==="canvas"?u.jsx(hP,{block:e}):e.type==="error"?u.jsxs("div",{className:"agent-error",children:["⚠ ",e.text]}):null}function hP({block:e}){var r,i,s,o;if(e.phase==="result"&&!e.isError&&((r=e.data)==null?void 0:r.kind)==="theme"&&e.data.op==="set"){const a=(i=e.data.theme)==null?void 0:i.name;return u.jsxs("div",{className:"canvas-card","data-testid":"canvas-card",children:[u.jsx("span",{className:"canvas-card-icon",children:"🎨"}),u.jsxs("span",{className:"canvas-card-text",children:["Restyled your workspace",a?u.jsxs(u.Fragment,{children:[" — ",u.jsx("strong",{children:a})]}):null]})]})}const t=(s=e.data)==null?void 0:s.block;if(e.phase==="call"||!t)return u.jsx("div",{className:"canvas-card is-pending","data-testid":"canvas-card",children:"🧩 Building a block…"});if(e.isError)return u.jsx("div",{className:"canvas-card is-error","data-testid":"canvas-card",children:"⚠ Couldn’t build that block."});const n=((o=e.data)==null?void 0:o.op)==="update"?"Updated":"Added";return u.jsxs("div",{className:"canvas-card","data-testid":"canvas-card",children:[u.jsx("span",{className:"canvas-card-icon",children:t.icon||"🧩"}),u.jsxs("span",{className:"canvas-card-text",children:[n," ",u.jsx("strong",{children:t.title})," to your canvas"]})]})}function dP({block:e,canReply:t,onQuickReply:n}){const r=e.input.questions;return u.jsxs("div",{className:"ask-card","data-testid":"ask-card",children:[u.jsxs("div",{className:"ask-head",children:[u.jsx("span",{className:"ask-icon",children:"🤔"}),u.jsx("span",{children:"Your call"})]}),r.map((i,s)=>u.jsx(fP,{q:i,canReply:t,onQuickReply:n},s)),u.jsx("div",{className:"ask-foot",children:"…or just type your answer below."})]})}function fP({q:e,canReply:t,onQuickReply:n}){const[r,i]=w.useState([]),s=!!e.multiSelect,o=Array.isArray(e.options)?e.options:[],a=l=>i(c=>c.includes(l)?c.filter(d=>d!==l):[...c,l]);return u.jsxs("div",{className:"ask-q",children:[e.header&&u.jsx("span",{className:"ask-q-header",children:e.header}),e.question&&u.jsx("p",{className:"ask-q-text",children:e.question}),u.jsx("div",{className:"ask-options",children:o.map((l,c)=>s?u.jsxs("button",{type:"button",className:`ask-opt${r.includes(l.label)?" sel":""}`,disabled:!t,onClick:()=>a(l.label),title:l.description||"",children:[u.jsx("span",{className:"ask-opt-check",children:r.includes(l.label)?"☑":"☐"}),u.jsxs("span",{className:"ask-opt-main",children:[u.jsx("span",{className:"ask-opt-label",children:l.label}),l.description&&u.jsx("span",{className:"ask-opt-desc",children:l.description})]})]},c):u.jsxs("button",{type:"button",className:"ask-opt",disabled:!t,onClick:()=>t&&n(l.label),title:l.description||"",children:[u.jsxs("span",{className:"ask-opt-main",children:[u.jsx("span",{className:"ask-opt-label",children:l.label}),l.description&&u.jsx("span",{className:"ask-opt-desc",children:l.description})]}),u.jsx("span",{className:"ask-opt-go",children:"→"})]},c))}),s&&u.jsxs("button",{type:"button",className:"primary ask-send",disabled:!t||!r.length,onClick:()=>t&&r.length&&n(r.join(", ")),children:["Send",r.length?` (${r.length})`:""]})]})}function pP({url:e}){let t=e;try{const n=new URL(e);t=`${n.host}${n.pathname==="/"?"":n.pathname}`}catch{}return u.jsxs("div",{className:"chat-msg win-card","data-testid":"win-card",children:[u.jsx("span",{className:"win-spark",children:"✨"}),u.jsxs("div",{className:"win-body",children:[u.jsx("span",{className:"win-lead",children:"It’s live — this is yours:"}),u.jsx("a",{className:"win-url",href:e,target:"_blank",rel:"noreferrer",children:t}),u.jsx("span",{className:"win-sub",children:"Open it, or send it to someone."})]})]})}function mP(){return u.jsxs("div",{className:"agent-working","data-testid":"agent-working",children:[u.jsxs("span",{className:"dots",children:[u.jsx("i",{}),u.jsx("i",{}),u.jsx("i",{})]}),"working"]})}function gP({usage:e,costUsd:t,durationMs:n}){const r=typeof t=="number"?t:e==null?void 0:e.cost_usd;return u.jsxs("div",{className:"usage-footer","data-testid":"usage-footer",children:[(e==null?void 0:e.output_tokens)!=null&&u.jsxs("span",{title:"output tokens",children:["↑ ",e.output_tokens.toLocaleString()]}),typeof r=="number"&&r>0&&u.jsxs("span",{title:"cost (USD)",children:["$",r.toFixed(4)]}),n!=null&&u.jsxs("span",{children:[(n/1e3).toFixed(1),"s"]})]})}function yP({role:e,connected:t,agentName:n,canSend:r,onSend:i}){if(e==="client")return u.jsxs("div",{className:"chat-empty","data-testid":"chat-empty",children:[u.jsx("div",{className:"chat-empty-mark",children:"✦"}),u.jsx("p",{className:"chat-empty-title",children:"Describe what you’d like changed"}),u.jsx("p",{className:"chat-empty-sub",children:"The team’s AI agent will pick it up and you’ll see it here."}),!t&&u.jsx("p",{className:"chat-empty-warn",children:"connecting to the agent bridge…"})]});const s=n&&n!=="Chat"?n:null,o=[{label:"✦ Build my workspace for me",display:"Build my workspace for me.",primary:!0,prompt:"Set up a friendly starter workspace for me. Use your canvas tools to add a couple of useful blocks — for example a short welcome note, a quick getting-started checklist, and maybe a tips block — and pick a warm, welcoming theme if you'd like. Narrate as you go in short plain lines (one line per step, no jargon) so I can watch it come together. Then say a brief, friendly hello telling me what you set up. Keep it light."},{label:"Show me around",display:"Show me around.",prompt:"What's in this workspace? Give me a quick, friendly tour."},{label:"Make something I can show off",display:"Make something I can show off.",prompt:"Build me a simple, good-looking landing page, and put a Live view on my canvas so I can watch it come together. Narrate as you go in short plain lines — one line per step, no jargon. When it’s done, tell me where to see it."}];return u.jsxs("div",{className:"chat-empty","data-testid":"chat-empty",children:[u.jsx("div",{className:"chat-empty-mark",children:"✦"}),u.jsx("p",{className:"chat-empty-title",children:s?`Hi — I’m ${s}.`:"Hi — I’m your agent."}),u.jsx("p",{className:"chat-empty-sub",children:"Tell me what you’re working on and I’ll set it up for you — I can build, write, and arrange your workspace as we go. Not sure where to start?"}),u.jsx("div",{className:"chat-empty-starters",children:o.map(a=>u.jsx("button",{type:"button",className:`chat-empty-starter${a.primary?" primary":""}`,onClick:()=>i==null?void 0:i(a.prompt,a.display),disabled:!r||!t,"data-testid":"chat-empty-starter",children:a.label},a.label))}),!t&&u.jsx("p",{className:"chat-empty-warn",children:"connecting to the agent bridge…"}),u.jsx(Jc,{variant:"ambient"})]})}function _P(e){var n;const t=(n=e==null?void 0:e.session)==null?void 0:n.source;return t==="localhost"||t==="loopback"}function vP(e){return(String(e||"?").split("@")[0].replace(/[^a-zA-Z0-9]/g,"").slice(0,2)||"?").toUpperCase()}function bP(e){let t=0;const n=String(e||"");for(let r=0;r<n.length;r+=1)t=(t*31+n.charCodeAt(r))%360;return`hsl(${t} 52% 42%)`}function wP(e){if(!e)return"";const t=String(e).split(/[\\/]/).filter(Boolean);return t[t.length-1]||e}function SP({session:e,onEnter:t,onClose:n,autoEnterSingle:r=!1}){var Ue;const[i,s]=w.useState(null),[o,a]=w.useState(null),[l,c]=w.useState(!1),[d,h]=w.useState(0),[f,m]=w.useState(""),[p,y]=w.useState(""),[b,_]=w.useState(!1),[v,g]=w.useState(null),[S,k]=w.useState(null),[x,T]=w.useState(""),[L,B]=w.useState(null),[j,F]=w.useState(null),[A,R]=w.useState(""),[P,N]=w.useState(""),[O,W]=w.useState(null),[D,I]=w.useState({}),C=w.useRef(null),X=_P(e),ie=!!((Ue=e==null?void 0:e.account)!=null&&Ue.email);async function E(){try{const M=await fetch("/api/lobby/workspaces");if(!M.ok)throw new Error(`HTTP ${M.status}`);const ae=await M.json();s(Array.isArray(ae.workspaces)?ae.workspaces:[])}catch(M){a(String((M==null?void 0:M.message)||M)),s([])}}w.useEffect(()=>{E()},[]),w.useEffect(()=>{var M;i&&i.length&&((M=C.current)==null||M.focus())},[i]);const ue=w.useRef(!1);w.useEffect(()=>{if(!r||!i||ue.current)return;const M=i.filter(ae=>!ae.joinable);M.length===1&&(ue.current=!0,ve(M[0]))},[r,i]);async function ve(M){if(!(!M||l)){if(M.joinable){ge(M);return}c(!0);try{await fetch(`/api/lobby/workspaces/${encodeURIComponent(M.id)}/open`,{method:"POST"})}catch{}t(M.id)}}async function Z({name:M,dir:ae}){if(!l){c(!0),a(null);try{const re=await fetch("/api/lobby/workspaces",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(M?{name:M}:{dir:ae})}),Ee=await re.json().catch(()=>null);if(!re.ok){a((Ee==null?void 0:Ee.message)||(Ee==null?void 0:Ee.error)||`create failed (HTTP ${re.status})`),c(!1);return}t(Ee.workspace.id)}catch(re){a(String((re==null?void 0:re.message)||re)),c(!1)}}}async function pe(M){if(!l){c(!0),a(null);try{const ae=await fetch(`/api/lobby/workspaces/${encodeURIComponent(M.id)}/share`,{method:"POST"}),re=await ae.json().catch(()=>null);if(!ae.ok){a((re==null?void 0:re.message)||(re==null?void 0:re.error)||`couldn’t share (HTTP ${ae.status})`);return}g(null),await E(),k(M.id),B(null),T("")}catch(ae){a(String((ae==null?void 0:ae.message)||ae))}finally{c(!1)}}}async function ce(M){const ae=x.trim();if(!(!ae||l)){c(!0),B(null);try{const re=await fetch(`/api/lobby/workspaces/${encodeURIComponent(M.id)}/invite`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:ae})}),Ee=await re.json().catch(()=>null);if(!re.ok){B({ok:!1,text:(Ee==null?void 0:Ee.message)||(Ee==null?void 0:Ee.error)||`invite failed (HTTP ${re.status})`});return}B({ok:!0,text:Ee!=null&&Ee.pending?`Invited ${ae}. They’ll see this workspace the next time they sign in to VentureWild — just let them know to sign in.`:`${ae} is in — they’ll see this workspace when they sign in.`}),T("")}catch(re){B({ok:!1,text:String((re==null?void 0:re.message)||re)})}finally{c(!1)}}}function ge(M){F(ae=>ae===M.id?null:M.id),R(M.name||""),N(""),a(null)}async function Pe(M){const ae=O!==M.id;if(W(ae?M.id:null),!(!ae||D[M.id])){I(re=>({...re,[M.id]:{loading:!0,members:[]}}));try{const Ee=await(await fetch(`/api/lobby/workspaces/${encodeURIComponent(M.id)}/members`)).json().catch(()=>null);I(G=>({...G,[M.id]:{loading:!1,members:Array.isArray(Ee==null?void 0:Ee.members)?Ee.members:[]}}))}catch{I(re=>({...re,[M.id]:{loading:!1,members:[]}}))}}}w.useEffect(()=>{if(!O)return;const M=O;let ae=!1;const Ee=setInterval(async()=>{try{const se=await(await fetch(`/api/lobby/workspaces/${encodeURIComponent(M)}/members`)).json().catch(()=>null);if(ae||!Array.isArray(se==null?void 0:se.members))return;I(ke=>({...ke,[M]:{loading:!1,members:se.members}}))}catch{}},2e4);return()=>{ae=!0,clearInterval(Ee)}},[O]);async function we(M){var ae;if(!l){c(!0),a(null);try{const re=P.trim(),Ee={slug:((ae=M.shared)==null?void 0:ae.slug)||M.slug};re?Ee.dir=re:Ee.name=A.trim()||M.name;const G=await fetch("/api/lobby/workspaces/join",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Ee)}),se=await G.json().catch(()=>null);if(!G.ok){a((se==null?void 0:se.message)||(se==null?void 0:se.error)||`couldn’t join (HTTP ${G.status})`);return}t(se.workspace.id)}catch(re){a(String((re==null?void 0:re.message)||re))}finally{c(!1)}}}function Be(M){var ae;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{...wy,...NP},children:[u.jsxs("div",{style:{...Sy,cursor:"default"},children:[u.jsx("span",{style:{fontWeight:600},children:M.name}),u.jsx("span",{"data-testid":`lobby-shared-${M.id}`,style:xy,children:"shared"}),u.jsx("span",{style:{flex:1}}),u.jsx("span",{style:{color:"var(--text-muted)",fontSize:12},children:(ae=M.shared)!=null&&ae.ownerEmail?`invited by ${M.shared.ownerEmail}`:"shared with you"})]}),X?u.jsx("button",{"data-testid":`lobby-join-${M.id}`,onClick:()=>ge(M),disabled:l,style:nl,title:"Save it to a folder on this computer",children:"Join"}):u.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",paddingRight:4},children:"join from your computer"})]}),j===M.id&&u.jsxs("div",{"data-testid":`lobby-join-panel-${M.id}`,style:rl,children:[u.jsxs("p",{style:{margin:"0 0 8px",fontSize:13,lineHeight:1.5},children:["Pick where ",u.jsx("strong",{children:M.name})," lives on this computer — your agent here joins the shared brain."]}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("input",{"data-testid":`lobby-join-name-${M.id}`,value:A,onChange:re=>R(re.target.value),onKeyDown:re=>{re.key==="Enter"&&we(M)},placeholder:"Folder name…",style:wo,disabled:l}),u.jsx("button",{className:"primary","data-testid":`lobby-join-confirm-${M.id}`,onClick:()=>we(M),disabled:l,children:"Join"})]}),u.jsx("input",{"data-testid":`lobby-join-path-${M.id}`,value:P,onChange:re=>N(re.target.value),placeholder:"…or paste an existing folder path",style:{...wo,marginTop:8,width:"100%"},disabled:l})]})]})}function be(M){!i||!i.length||(M.key==="ArrowDown"?(M.preventDefault(),h(ae=>Math.min(i.length-1,ae+1))):M.key==="ArrowUp"?(M.preventDefault(),h(ae=>Math.max(0,ae-1))):M.key==="Enter"&&(M.preventDefault(),ve(i[d])))}return u.jsx("div",{className:"app lobby fd-wallpaper","data-testid":"lobby",style:xP,children:u.jsxs("div",{style:kP,children:[u.jsxs("header",{style:{marginBottom:18},children:[u.jsx("div",{style:{marginBottom:12},children:u.jsxs("span",{className:"fd-brand",children:[u.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]})}),u.jsx("h1",{style:{margin:0,fontSize:22},children:"Your workspaces"}),u.jsxs("p",{style:{margin:"6px 0 0",color:"var(--text-muted)",fontSize:13},children:["Pick one to dive in",X?", or start a new one":"",". Each keeps its own files and its own agent."]})]}),o&&u.jsx("p",{"data-testid":"lobby-error",style:{color:"var(--error)",fontSize:13},children:o}),i===null?u.jsxs("div",{style:{color:"var(--text-muted)",padding:12},children:[u.jsx("span",{className:"spinner"})," Loading…"]}):i.length===0?u.jsxs("div",{"data-testid":"lobby-empty",style:CP,children:[u.jsx("div",{style:{fontSize:26,marginBottom:6},children:"✦"}),u.jsx("p",{style:{margin:"0 0 4px",fontSize:16,fontWeight:600},children:X?"Let's create your first workspace":"No workspaces here yet"}),u.jsx("p",{style:{margin:0,color:"var(--text-muted)",fontSize:13,lineHeight:1.5},children:X?"A workspace is just a folder your agent works in. Name one below — your agent meets you inside.":"Create one on your computer to get started; its files live there."})]}):u.jsx("ul",{ref:C,tabIndex:0,onKeyDown:be,"data-testid":"lobby-list",style:{listStyle:"none",margin:0,padding:0,outline:"none"},children:i.map((M,ae)=>{var re,Ee,G,se;return u.jsx("li",{children:M.joinable?Be(M):u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{...wy,...ae===d?EP:null},children:[u.jsxs("button",{"data-testid":`lobby-card-${M.id}`,onClick:()=>{h(ae),ve(M)},disabled:l,style:Sy,children:[u.jsx("span",{style:{fontWeight:600},children:M.name}),M.isDefault&&u.jsx("span",{style:jP,children:"default"}),M.kind==="shared"&&u.jsx("span",{"data-testid":`lobby-shared-${M.id}`,style:xy,children:"shared"}),M.kind==="shared"&&u.jsx("span",{"data-testid":`lobby-sync-${M.id}`,style:(re=M.shared)!=null&&re.projectCode?DS:RP,title:(Ee=M.shared)!=null&&Ee.projectCode?"Files replicate to teammates via VentureWild":"File sync starts when this computer’s sync service is online",children:(G=M.shared)!=null&&G.projectCode?"⟳ synced":"sync pending"}),u.jsx("span",{style:{flex:1}}),u.jsxs("span",{style:{color:"var(--text-muted)",fontSize:12},title:M.dir,children:["📁 ",wP(M.dir)]})]}),X&&ie&&M.kind!=="shared"&&u.jsx("button",{"data-testid":`lobby-share-${M.id}`,onClick:()=>{g(M.id),k(null)},disabled:l,style:nl,title:"Make this a shared workspace",children:"Share"}),X&&ie&&M.kind==="shared"&&((se=M.shared)==null?void 0:se.role)==="owner"&&u.jsx("button",{"data-testid":`lobby-invite-toggle-${M.id}`,onClick:()=>{k(ke=>ke===M.id?null:M.id),B(null)},disabled:l,style:nl,title:"Invite a teammate",children:"+ Invite"}),ie&&M.kind==="shared"&&u.jsx("button",{"data-testid":`lobby-members-toggle-${M.id}`,onClick:()=>Pe(M),disabled:l,style:nl,title:"See who's in this workspace",children:"Members"})]}),O===M.id&&M.kind==="shared"&&u.jsx("div",{"data-testid":`lobby-roster-${M.id}`,style:rl,children:(()=>{const ke=D[M.id];return!ke||ke.loading?u.jsx("p",{style:ky,children:"Loading members…"}):ke.members.length?u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:ke.members.map(($e,Ve)=>{const St=$e.status==="invited",mt=!St&&!!$e.online;return u.jsxs("div",{"data-testid":`lobby-roster-member-${M.id}-${Ve}`,style:{display:"flex",alignItems:"center",gap:8},children:[u.jsxs("span",{style:{position:"relative",display:"inline-flex"},children:[u.jsx("span",{"aria-hidden":!0,style:{...DP,background:bP($e.email),opacity:St?.5:mt?1:.55},children:vP($e.email)}),mt&&u.jsx("span",{"aria-hidden":!0,"data-testid":`lobby-roster-online-${M.id}-${Ve}`,style:PP})]}),u.jsx("span",{style:TP,children:$e.email}),u.jsx("span",{style:St?MP:$e.role==="owner"?AP:IP,children:St?"invited":$e.role}),mt&&u.jsx("span",{style:LP,title:"Active now",children:"online"})]},$e.account_id||$e.email||Ve)})}):u.jsx("p",{style:ky,children:"Just you so far — invite a teammate to grow the team."})})()}),v===M.id&&u.jsxs("div",{"data-testid":`lobby-share-prompt-${M.id}`,style:rl,children:[u.jsxs("p",{style:{margin:"0 0 8px",fontSize:13,lineHeight:1.5},children:["Make ",u.jsx("strong",{children:M.name})," a shared workspace? Teammates you invite become ",u.jsx("strong",{children:"equal members"})," — they get the files ",u.jsx("strong",{children:"and"})," ","everything your agent has learned about this work. That shared memory is the point."]}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{className:"primary","data-testid":`lobby-share-confirm-${M.id}`,onClick:()=>pe(M),disabled:l,children:"Share it"}),u.jsx("button",{onClick:()=>g(null),disabled:l,children:"Cancel"})]})]}),S===M.id&&M.kind==="shared"&&u.jsxs("div",{"data-testid":`lobby-invite-${M.id}`,style:rl,children:[u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("input",{"data-testid":`lobby-invite-email-${M.id}`,type:"email",value:x,onChange:ke=>T(ke.target.value),onKeyDown:ke=>{ke.key==="Enter"&&x.trim()&&ce(M)},placeholder:"teammate@email.com",style:wo,disabled:l}),u.jsx("button",{className:"primary","data-testid":`lobby-invite-send-${M.id}`,onClick:()=>ce(M),disabled:l||!x.trim(),children:"Send invite"})]}),L&&u.jsx("p",{"data-testid":`lobby-invite-msg-${M.id}`,style:{margin:"8px 0 0",fontSize:12,color:L.ok?"var(--accent, #0891b2)":"var(--error)"},children:L.text})]})]})},M.id)})}),X&&u.jsxs("div",{style:{marginTop:18,borderTop:"1px solid var(--border)",paddingTop:16},children:[u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("input",{"data-testid":"lobby-new-name",value:f,onChange:M=>m(M.target.value),onKeyDown:M=>{M.key==="Enter"&&f.trim()&&Z({name:f.trim()})},placeholder:"Name a new workspace…",style:wo,disabled:l}),u.jsx("button",{className:"primary","data-testid":"lobby-create",onClick:()=>f.trim()&&Z({name:f.trim()}),disabled:l||!f.trim(),children:"+ New workspace"})]}),b?u.jsxs("div",{style:{display:"flex",gap:8,marginTop:8},children:[u.jsx("input",{"data-testid":"lobby-open-path",value:p,onChange:M=>y(M.target.value),onKeyDown:M=>{M.key==="Enter"&&p.trim()&&Z({dir:p.trim()})},placeholder:"…or paste the path to an existing folder",style:wo,disabled:l}),u.jsx("button",{"data-testid":"lobby-open",onClick:()=>p.trim()&&Z({dir:p.trim()}),disabled:l||!p.trim(),children:"Open folder"})]}):u.jsx("button",{"data-testid":"lobby-open-toggle",onClick:()=>_(!0),style:{marginTop:8,background:"none",border:"none",color:"var(--accent, #4a90d9)",cursor:"pointer",fontSize:13,padding:0},children:"or open an existing folder →"})]}),n&&u.jsx("div",{style:{marginTop:18},children:u.jsx("button",{"data-testid":"lobby-close",onClick:n,children:"← Back to my workspace"})})]})})}const xP={display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"10vh 16px",height:"100%",overflow:"auto"},kP={width:"100%",maxWidth:640,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"var(--r-xl)",boxShadow:"var(--shadow-lg)",padding:"28px 32px"},CP={textAlign:"center",padding:"20px 16px 24px",border:"1px dashed var(--border)",borderRadius:12,marginBottom:8},wy={display:"flex",alignItems:"center",gap:8,width:"100%",marginBottom:8,borderRadius:10,border:"1px solid var(--border)",background:"var(--surface, transparent)",boxShadow:"var(--shadow-sm)",paddingRight:10},Sy={display:"flex",alignItems:"center",gap:10,flex:1,minWidth:0,textAlign:"left",padding:"12px 14px",background:"none",border:"none",borderRadius:10,color:"inherit",font:"inherit",cursor:"pointer"},EP={border:"1px solid var(--accent, #4a90d9)",boxShadow:"0 0 0 1px var(--accent, #4a90d9)"},NP={borderStyle:"dashed"},jP={fontSize:11,padding:"1px 6px",borderRadius:6,border:"1px solid var(--border)",color:"var(--text-muted)"},xy={fontSize:11,padding:"1px 6px",borderRadius:6,border:"1px solid var(--accent, #0891b2)",color:"var(--accent, #0891b2)"},DS={fontSize:11,padding:"1px 6px",borderRadius:6,color:"var(--text-muted)"},RP={...DS,fontStyle:"italic",opacity:.75},nl={fontSize:12,padding:"5px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit",cursor:"pointer",whiteSpace:"nowrap"},rl={margin:"-2px 0 10px",padding:"10px 12px",borderRadius:10,border:"1px solid var(--border)",background:"var(--surface-2, var(--surface, transparent))"},wo={flex:1,padding:"8px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit"},ky={margin:0,fontSize:12,color:"var(--text-muted)"},TP={fontSize:13,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},DP={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:999,flexShrink:0,fontSize:10,fontWeight:700,color:"#fff",letterSpacing:.3},PP={position:"absolute",right:-1,bottom:-1,width:8,height:8,borderRadius:999,background:"#22c55e",border:"1.5px solid var(--surface, #fff)"},LP={fontSize:10,color:"#16a34a",fontWeight:600,whiteSpace:"nowrap"},Op={fontSize:10,padding:"1px 6px",borderRadius:6,whiteSpace:"nowrap"},AP={...Op,border:"1px solid var(--accent, #0891b2)",color:"var(--accent, #0891b2)"},IP={...Op,border:"1px solid var(--border)",color:"var(--text-muted)"},MP={...Op,border:"1px dashed var(--border)",color:"var(--text-muted)",fontStyle:"italic"};function os(e){const{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function kr(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function il(e,t,n,r,i,s,o){const{margin:a,containerPadding:l,rowHeight:c}=e,d=os(e);let h,f,m,p;if(o?(h=Math.round(o.width),f=Math.round(o.height)):(h=kr(r,d,a[0]),f=kr(i,c,a[1])),s?(m=Math.round(s.top),p=Math.round(s.left)):o?(m=Math.round(o.top),p=Math.round(o.left)):(m=Math.round((c+a[1])*n+l[1]),p=Math.round((d+a[0])*t+l[0])),!s&&!o){if(Number.isFinite(r)){const b=Math.round((d+a[0])*(t+r)+l[0])-p-h;b!==a[0]&&(h+=b-a[0])}if(Number.isFinite(i)){const b=Math.round((c+a[1])*(n+i)+l[1])-m-f;b!==a[1]&&(f+=b-a[1])}}return{top:m,left:p,width:h,height:f}}function OP(e,t,n,r,i){const{margin:s,containerPadding:o,cols:a,rowHeight:l,maxRows:c}=e,d=os(e);let h=Math.round((n-o[0])/(d+s[0])),f=Math.round((t-o[1])/(l+s[1]));return h=_c(h,0,a-r),f=_c(f,0,c-i),{x:h,y:f}}function sl(e,t,n){const{margin:r,containerPadding:i,rowHeight:s}=e,o=os(e),a=Math.round((n-i[0])/(o+r[0])),l=Math.round((t-i[1])/(s+r[1]));return{x:a,y:l}}function zP(e,t,n){const{margin:r,rowHeight:i}=e,s=os(e),o=Math.max(1,Math.round((t+r[0])/(s+r[0]))),a=Math.max(1,Math.round((n+r[1])/(i+r[1])));return{w:o,h:a}}function _c(e,t,n){return Math.max(Math.min(e,n),t)}function zp(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function Zi(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r!==void 0&&zp(r,t))return r}}function PS(e,t){return e.filter(n=>zp(n,t))}function BP(e,t){return t==="horizontal"?LS(e):t==="vertical"||t==="wrap"?Dd(e):[...e]}function Dd(e){return[...e].sort((t,n)=>t.y!==n.y?t.y-n.y:t.x-n.x)}function LS(e){return[...e].sort((t,n)=>t.x!==n.x?t.x-n.x:t.y-n.y)}function Zc(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(r!==void 0){const i=r.y+r.h;i>t&&(t=i)}}return t}function $i(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r!==void 0&&r.i===t)return r}}function Qc(e){return e.filter(t=>t.static===!0)}function as(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function Ei(e){const t=new Array(e.length);for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&(t[n]=as(r))}return t}function FP(e,t){const n=new Array(e.length);for(let r=0;r<e.length;r++){const i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function $P(e,t,n){let r=$i(e,t);return r?(r=n(as(r)),[FP(e,r),r]):[[...e],null]}function Bp(e,t){const n=Qc(e);for(let r=0;r<e.length;r++){const i=e[r];if(i!==void 0)if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Zi(n,i);)i.y++}return e}function Yi(e,t,n,r,i,s,o,a,l){if(t.static&&t.isDraggable!==!0)return[...e];if(t.y===r&&t.x===n)return[...e];const c=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=BP(e,o);(o==="vertical"&&typeof r=="number"?d>=r:o==="horizontal"&&typeof n=="number"?c>=n:!1)&&(h=h.reverse());const m=PS(h,t),p=m.length>0;if(p&&l)return Ei(e);if(p&&s)return t.x=c,t.y=d,t.moved=!1,e;let y=[...e];for(let b=0;b<m.length;b++){const _=m[b];_!==void 0&&(_.moved||(_.static?y=Cy(y,_,t,i,o):y=Cy(y,t,_,i,o)))}return y}function Cy(e,t,n,r,i,s){const o=i==="horizontal",a=i==="vertical",l=t.static;if(r){r=!1;const h={x:o?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},f=Zi(e,h),m=f!==void 0&&f.y+f.h>t.y,p=f!==void 0&&t.x+t.w>f.x;if(!f)return Yi(e,n,o?h.x:void 0,a?h.y:void 0,r,l,i);if(m&&a)return Yi(e,n,void 0,n.y+1,r,l,i);if(m&&i===null)return t.y=n.y,n.y=n.y+n.h,[...e];if(p&&o)return Yi(e,t,n.x,void 0,r,l,i)}const c=o?n.x+1:void 0,d=a?n.y+1:void 0;return c===void 0&&d===void 0?[...e]:Yi(e,n,c,d,r,l,i)}function Ms(e,t,n){return Math.max(t,Math.min(n,e))}var HP={name:"gridBounds",constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:Ms(t,0,Math.max(0,r-e.w)),y:Ms(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:s}){const o=r==="w"||r==="nw"||r==="sw"?e.x+e.w:i-e.x,a=r==="n"||r==="nw"||r==="ne"?e.y+e.h:s-e.y;return{w:Ms(t,1,Math.max(1,o)),h:Ms(n,1,Math.max(1,a))}}},WP={name:"minMaxSize",constrainSize(e,t,n){return{w:Ms(t,e.minW??1,e.maxW??1/0),h:Ms(n,e.minH??1,e.maxH??1/0)}}},AS=[HP,WP];function ol(e,t,n,r,i){let s={x:n,y:r};for(const o of e)o.constrainPosition&&(s=o.constrainPosition(t,s.x,s.y,i));if(t.constraints)for(const o of t.constraints)o.constrainPosition&&(s=o.constrainPosition(t,s.x,s.y,i));return s}function UP(e,t,n,r,i,s){let o={w:n,h:r};for(const a of e)a.constrainSize&&(o=a.constrainSize(t,o.w,o.h,i,s));if(t.constraints)for(const a of t.constraints)a.constrainSize&&(o=a.constrainSize(t,o.w,o.h,i,s));return o}function Fp({top:e,left:t,width:n,height:r}){const i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:"absolute"}}function IS({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:"absolute"}}function Ey(e){return e*100+"%"}function VP(e,t,n,r){return e+n>r?t:n}function MS(e,t,n){return e<0?t:n}function qP(e){return Math.max(0,e)}function vc(e){return Math.max(0,e)}var $p=(e,t,n)=>{const{left:r,height:i,width:s}=t,o=e.top-(i-e.height);return{left:r,width:s,height:MS(o,e.height,i),top:vc(o)}},Hp=(e,t,n)=>{const{top:r,left:i,height:s,width:o}=t;return{top:r,height:s,width:VP(e.left,e.width,o,n),left:qP(i)}},Wp=(e,t,n)=>{const{top:r,height:i,width:s}=t,o=e.left+e.width-s;return o<0?{height:i,width:e.left+e.width,top:vc(r),left:0}:{height:i,width:s,top:vc(r),left:o}},Up=(e,t,n)=>{const{top:r,left:i,height:s,width:o}=t;return{width:o,left:i,height:MS(r,e.height,s),top:vc(r)}},KP=(e,t,n)=>$p(e,Hp(e,t,n)),YP=(e,t,n)=>$p(e,Wp(e,t)),GP=(e,t,n)=>Up(e,Hp(e,t,n)),XP=(e,t,n)=>Up(e,Wp(e,t)),JP={n:$p,ne:KP,e:Hp,se:GP,s:Up,sw:XP,w:Wp,nw:YP};function ZP(e,t,n,r){const i=JP[e];return i?i(t,{...t,...n},r):n}var OS={type:"transform",scale:1,calcStyle(e){return Fp(e)}},QP={type:"absolute",scale:1,calcStyle(e){return IS(e)}};function eL(e){return{type:"transform",scale:e,calcStyle(t){return Fp(t)},calcDragPosition(t,n,r,i){return{left:(t-r)/e,top:(n-i)/e}}}}var tL=OS,nL={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},rL={enabled:!0,bounded:!1,threshold:3},iL={enabled:!0,handles:["se"]},sL={enabled:!1,defaultItem:{w:1,h:1}};function Vp(e,t,n,r,i){const s=r==="x"?"w":"h";t[r]+=1;const o=e.findIndex(l=>l.i===t.i),a=i??Qc(e).length>0;for(let l=o+1;l<e.length;l++){const c=e[l];if(c!==void 0&&!c.static){if(!a&&c.y>t.y+t.h)break;zp(t,c)&&Vp(e,c,n+t[s],r,a)}}t[r]=n}function oL(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!Zi(e,t);)t.y--;let i;for(;(i=Zi(e,t))!==void 0;)Vp(n,t,i.y+i.h,"y");return t.y=Math.max(t.y,0),t}function aL(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!Zi(e,t);)t.x--;let i;for(;(i=Zi(e,t))!==void 0;)if(Vp(r,t,i.x+i.w,"x"),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!Zi(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var zS={type:"vertical",allowOverlap:!1,compact(e,t){const n=Qc(e);let r=Zc(n);const i=Dd(e),s=new Array(e.length);for(let o=0;o<i.length;o++){const a=i[o];if(a===void 0)continue;let l=as(a);l.static||(l=oL(n,l,i,r),r=Math.max(r,l.y+l.h),n.push(l));const c=e.indexOf(a);s[c]=l,l.moved=!1}return s}},BS={type:"horizontal",allowOverlap:!1,compact(e,t){const n=Qc(e),r=LS(e),i=new Array(e.length);for(let s=0;s<r.length;s++){const o=r[s];if(o===void 0)continue;let a=as(o);a.static||(a=aL(n,a,t,r),n.push(a));const l=e.indexOf(o);i[l]=a,a.moved=!1}return i}},FS={type:null,allowOverlap:!1,compact(e,t){return Ei(e)}},lL={...zS,allowOverlap:!0,compact(e,t){return Ei(e)}},cL={...BS,allowOverlap:!0,compact(e,t){return Ei(e)}},uL={...FS,allowOverlap:!0};function eu(e,t=!1,n=!1){let r;return t?e==="vertical"?r=lL:e==="horizontal"?r=cL:r=uL:e==="vertical"?r=zS:e==="horizontal"?r=BS:r=FS,n?{...r,preventCollision:n}:r}function $S(e){return Object.keys(e).sort((n,r)=>e[n]-e[r])}function Ny(e,t){const n=$S(e);let r=n[0];if(r===void 0)throw new Error("No breakpoints defined");for(let i=1;i<n.length;i++){const s=n[i];if(s===void 0)continue;const o=e[s];t>o&&(r=s)}return r}function jy(e,t){const n=t[e];if(n===void 0)throw new Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function Zu(e,t,n,r,i,s){const o=e[n];if(o)return Ei(o);let a=e[r];const l=$S(t),c=l.slice(l.indexOf(n));for(let m=0;m<c.length;m++){const p=c[m];if(p===void 0)continue;const y=e[p];if(y){a=y;break}}const d=Ei(a||[]),h=Bp(d,{cols:i});return(typeof s=="object"&&s!==null?s:eu(s)).compact(h,i)}function al(e,t){if(Array.isArray(e))return e;const n=e,r=n[t];if(r!==void 0)return r;const i=Object.keys(n);for(const s of i){const o=n[s];if(o!==void 0)return o}return[10,10]}var HS={exports:{}},hL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",dL=hL,fL=dL;function WS(){}function US(){}US.resetWarningCache=WS;var pL=function(){function e(r,i,s,o,a,l){if(l!==fL){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:US,resetWarningCache:WS};return n.PropTypes=n,n};HS.exports=pL();var qp=HS.exports;const Ie=ba(qp);var mL={};function Pd(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Ry(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Lo(e){return typeof e=="number"&&!isNaN(e)}function hn(e){return parseInt(e,10)}function qs(e,t,n){if(e[t])return new Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var Qu=["Moz","Webkit","O","ms"];function gL(e="transform"){var t,n;if(typeof window>"u")return"";const r=(n=(t=window.document)==null?void 0:t.documentElement)==null?void 0:n.style;if(!r||e in r)return"";for(let i=0;i<Qu.length;i++)if(VS(e,Qu[i])in r)return Qu[i];return""}function VS(e,t){return t?`${t}${yL(e)}`:e}function yL(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}var _L=gL(),eh="";function vL(e,t){var n;eh||(eh=(n=Pd(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(i){return Ry(e[i])}))!=null?n:"");const r=e[eh];return Ry(r)?!!r.call(e,t):!1}function Ty(e,t,n){let r=e;do{if(vL(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function th(e,t,n,r){if(!e)return;const i={capture:!0,...r},s=n;e.addEventListener?e.addEventListener(t,s,i):e.attachEvent?e.attachEvent("on"+t,s):e["on"+t]=s}function Mi(e,t,n,r){if(!e)return;const i={capture:!0,...r},s=n;e.removeEventListener?e.removeEventListener(t,s,i):e.detachEvent?e.detachEvent("on"+t,s):e["on"+t]=null}function bL(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=hn(n.borderTopWidth),t+=hn(n.borderBottomWidth),t}function wL(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=hn(n.borderLeftWidth),t+=hn(n.borderRightWidth),t}function SL(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=hn(n.paddingTop),t-=hn(n.paddingBottom),t}function xL(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=hn(n.paddingLeft),t-=hn(n.paddingRight),t}function kL(e,t,n){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),s=(e.clientX+t.scrollLeft-i.left)/n,o=(e.clientY+t.scrollTop-i.top)/n;return{x:s,y:o}}function CL(e,t){const n=qS(e,t,"px");return{[VS("transform",_L)]:n}}function EL(e,t){return qS(e,t,"")}function qS({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;if(n){const s=`${typeof n.x=="string"?n.x:n.x+r}`,o=`${typeof n.y=="string"?n.y:n.y+r}`;i=`translate(${s}, ${o})`+i}return i}function NL(e,t){return e.targetTouches&&Pd(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&Pd(e.changedTouches,n=>t===n.identifier)}function jL(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function RL(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
90
|
+
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
91
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&TL(e.body,"react-draggable-transparent-selection")}function Dy(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{Py(e)}):Py(e)}function Py(e){if(e)try{e.body&&DL(e.body,"react-draggable-transparent-selection");const t=e.selection;if(t)t.empty();else{const n=(e.defaultView||window).getSelection();n&&n.type!=="Caret"&&n.removeAllRanges()}}catch{}}function TL(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function DL(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g"),"")}function PL(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:IL(r);const i=Kp(e);if(typeof r=="string"){const{ownerDocument:s}=i,o=s.defaultView;if(!o)throw new Error("Cannot resolve the owner window of the draggable node.");let a;if(r==="parent"?a=i.parentNode:a=i.getRootNode().querySelector(r),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=a,c=o.getComputedStyle(i),d=o.getComputedStyle(l);r={left:-i.offsetLeft+hn(d.paddingLeft)+hn(c.marginLeft),top:-i.offsetTop+hn(d.paddingTop)+hn(c.marginTop),right:xL(l)-wL(i)-i.offsetLeft+hn(d.paddingRight)-hn(c.marginRight),bottom:SL(l)-bL(i)-i.offsetTop+hn(d.paddingBottom)-hn(c.marginBottom)}}return Lo(r.right)&&(t=Math.min(t,r.right)),Lo(r.bottom)&&(n=Math.min(n,r.bottom)),Lo(r.left)&&(t=Math.max(t,r.left)),Lo(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Ly(e,t,n){const r=Math.round(t/e[0])*e[0],i=Math.round(n/e[1])*e[1];return[r,i]}function LL(e){return e.props.axis==="both"||e.props.axis==="x"}function AL(e){return e.props.axis==="both"||e.props.axis==="y"}function nh(e,t,n){const r=typeof t=="number"?NL(e,t):null;if(typeof t=="number"&&!r)return null;const i=Kp(n),s=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return kL(r||e,s,n.props.scale)}function rh(e,t,n){const r=!Lo(e.lastX),i=Kp(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function ih(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function IL(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Kp(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}function Cr(...e){mL.DRAGGABLE_DEBUG&&console.log(...e)}var ar={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},ni=ar.mouse,Di=class extends w.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button=="number"&&e.button!==0||e.ctrlKey))return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!Ty(e.target,this.props.handle,t)||this.props.cancel&&Ty(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const r=jL(e);this.touchIdentifier=r;const i=nh(e,r,this);if(i==null)return;const{x:s,y:o}=i,a=rh(this,s,o);Cr("DraggableCore: handleDragStart: %j",a),Cr("calling",this.props.onStart),!(this.props.onStart(e,a)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&RL(n),this.dragging=!0,this.lastX=s,this.lastY=o,th(n,ni.move,this.handleDrag),th(n,ni.stop,this.handleDragStop))},this.handleDrag=e=>{const t=nh(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let o=n-this.lastX,a=r-this.lastY;if([o,a]=Ly(this.props.grid,o,a),!o&&!a)return;n=this.lastX+o,r=this.lastY+a}const i=rh(this,n,r);if(Cr("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const o=document.createEvent("MouseEvents");o.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(o)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;const t=nh(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let a=n-this.lastX||0,l=r-this.lastY||0;[a,l]=Ly(this.props.grid,a,l),n=this.lastX+a,r=this.lastY+l}const i=rh(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const o=this.findDOMNode();o&&this.props.enableUserSelectHack&&Dy(o.ownerDocument),Cr("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,o&&(Cr("DraggableCore: Removing handlers"),Mi(o.ownerDocument,ni.move,this.handleDrag),Mi(o.ownerDocument,ni.stop,this.handleDragStop))},this.onMouseDown=e=>(ni=ar.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(ni=ar.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(ni=ar.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(ni=ar.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&th(e,ar.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;Mi(t,ar.mouse.move,this.handleDrag),Mi(t,ar.touch.move,this.handleDrag),Mi(t,ar.mouse.stop,this.handleDragStop),Mi(t,ar.touch.stop,this.handleDragStop),Mi(e,ar.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Dy(t)}}findDOMNode(){var e;if((e=this.props)!=null&&e.nodeRef)return this.props.nodeRef.current;const t=gw;return typeof t.findDOMNode=="function"?t.findDOMNode(this):(Cr("react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef"),null)}render(){return w.cloneElement(w.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Di.displayName="DraggableCore";Di.propTypes={allowAnyClick:Ie.bool,allowMobileScroll:Ie.bool,children:Ie.node.isRequired,disabled:Ie.bool,enableUserSelectHack:Ie.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ie.arrayOf(Ie.number),handle:Ie.string,cancel:Ie.string,nodeRef:Ie.object,onStart:Ie.func,onDrag:Ie.func,onStop:Ie.func,onMouseDown:Ie.func,scale:Ie.number,className:qs,style:qs,transform:qs};Di.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var tu=class extends w.Component{constructor(e){super(e),this.onDragStart=(t,n)=>{if(Cr("Draggable: onDragStart: %j",n),this.props.onStart(t,ih(this,n))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(t,n)=>{if(!this.state.dragging)return!1;Cr("Draggable: onDrag: %j",n);const r=ih(this,n),i={x:r.x,y:r.y,slackX:0,slackY:0};if(this.props.bounds){const{x:o,y:a}=i;i.x+=this.state.slackX,i.y+=this.state.slackY;const[l,c]=PL(this,i.x,i.y);i.x=l,i.y=c,i.slackX=this.state.slackX+(o-i.x),i.slackY=this.state.slackY+(a-i.y),r.x=i.x,r.y=i.y,r.deltaX=i.x-this.state.x,r.deltaY=i.y-this.state.y}if(this.props.onDrag(t,r)===!1)return!1;this.setState(i)},this.onDragStop=(t,n)=>{if(!this.state.dragging||this.props.onStop(t,ih(this,n))===!1)return!1;Cr("Draggable: onDragStop: %j",n);const i={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:o,y:a}=this.props.position;i.x=o,i.y=a}this.setState(i)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Cr("Draggable: getDerivedStateFromProps %j",{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var e;if((e=this.props)!=null&&e.nodeRef)return this.props.nodeRef.current;const t=gw;return typeof t.findDOMNode=="function"?t.findDOMNode(this):null}render(){const{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:s,defaultClassNameDragged:o,position:a,positionOffset:l,scale:c,...d}=this.props;let h={},f=null;const p=!!!a||this.state.dragging,y=a||r,b={x:LL(this)&&p?this.state.x:y.x,y:AL(this)&&p?this.state.y:y.y};this.state.isElementSVG?f=EL(b,l):h=CL(b,l);const _=w.Children.only(n),v=ao(_.props.className||"",i,{[s]:this.state.dragging,[o]:this.state.dragged});return w.createElement(Di,{...d,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},w.cloneElement(_,{className:v,style:{..._.props.style,...h},transform:f}))}};tu.displayName="Draggable";tu.propTypes={...Di.propTypes,axis:Ie.oneOf(["both","x","y","none"]),bounds:Ie.oneOfType([Ie.shape({left:Ie.number,right:Ie.number,top:Ie.number,bottom:Ie.number}),Ie.string,Ie.oneOf([!1])]),defaultClassName:Ie.string,defaultClassNameDragging:Ie.string,defaultClassNameDragged:Ie.string,defaultPosition:Ie.shape({x:Ie.number,y:Ie.number}),positionOffset:Ie.shape({x:Ie.oneOfType([Ie.number,Ie.string]),y:Ie.oneOfType([Ie.number,Ie.string])}),position:Ie.shape({x:Ie.number,y:Ie.number}),className:qs,style:qs,transform:qs};tu.defaultProps={...Di.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1};var ML=tu;const OL=Object.freeze(Object.defineProperty({__proto__:null,DraggableCore:Di,default:ML},Symbol.toStringTag,{value:"Module"}));var Yp={exports:{}},Ra={};const zL=i0(OL);var Gp={};Gp.__esModule=!0;Gp.cloneElement=UL;var BL=FL(w);function FL(e){return e&&e.__esModule?e:{default:e}}function Ay(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ay(Object(n),!0).forEach(function(r){$L(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ay(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $L(e,t,n){return(t=HL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HL(e){var t=WL(e,"string");return typeof t=="symbol"?t:t+""}function WL(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UL(e,t){return t.style&&e.props.style&&(t.style=Iy(Iy({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),BL.default.cloneElement(e,t)}var Ta={};Ta.__esModule=!0;Ta.resizableProps=void 0;var Ae=VL(qp);function VL(e){return e&&e.__esModule?e:{default:e}}Ta.resizableProps={axis:Ae.default.oneOf(["both","x","y","none"]),className:Ae.default.string,children:Ae.default.element.isRequired,draggableOpts:Ae.default.shape({allowAnyClick:Ae.default.bool,cancel:Ae.default.string,children:Ae.default.node,disabled:Ae.default.bool,enableUserSelectHack:Ae.default.bool,offsetParent:typeof Element<"u"?Ae.default.instanceOf(Element):Ae.default.any,grid:Ae.default.arrayOf(Ae.default.number),handle:Ae.default.string,nodeRef:Ae.default.object,onStart:Ae.default.func,onDrag:Ae.default.func,onStop:Ae.default.func,onMouseDown:Ae.default.func,scale:Ae.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t[0];return r.axis==="both"||r.axis==="y"?Ae.default.number.isRequired(...t):Ae.default.number(...t)},handle:Ae.default.oneOfType([Ae.default.node,Ae.default.func]),handleSize:Ae.default.arrayOf(Ae.default.number),lockAspectRatio:Ae.default.bool,maxConstraints:Ae.default.arrayOf(Ae.default.number),minConstraints:Ae.default.arrayOf(Ae.default.number),onResizeStop:Ae.default.func,onResizeStart:Ae.default.func,onResize:Ae.default.func,resizeHandles:Ae.default.arrayOf(Ae.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:Ae.default.number,width:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t[0];return r.axis==="both"||r.axis==="x"?Ae.default.number.isRequired(...t):Ae.default.number(...t)}};Ra.__esModule=!0;Ra.default=void 0;var ys=KS(w),qL=zL,KL=Gp,YL=Ta;const GL=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function KS(e,t){if(typeof WeakMap=="function")var n=new WeakMap,r=new WeakMap;return(KS=function(i,s){if(!s&&i&&i.__esModule)return i;var o,a,l={__proto__:null,default:i};if(i===null||typeof i!="object"&&typeof i!="function")return l;if(o=s?r:n){if(o.has(i))return o.get(i);o.set(i,l)}for(const c in i)c!=="default"&&{}.hasOwnProperty.call(i,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(i,c))&&(a.get||a.set)?o(l,c,a):l[c]=i[c]);return l})(e,t)}function Ld(){return Ld=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ld.apply(null,arguments)}function XL(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function My(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?My(Object(n),!0).forEach(function(r){JL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):My(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JL(e,t,n){return(t=ZL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZL(e){var t=QL(e,"string");return typeof t=="symbol"?t:t+""}function QL(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}let Xp=class extends ys.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(t,n){const r=this.props,i=r.minConstraints,s=r.maxConstraints,o=r.lockAspectRatio;if(!i&&!s&&!o)return[t,n];if(o){const f=this.props.width/this.props.height,m=t-this.props.width,p=n-this.props.height;Math.abs(m)>Math.abs(p*f)?n=t/f:t=n*f}const a=t,l=n;let c=this.slack||[0,0],d=c[0],h=c[1];return t+=d,n+=h,i&&(t=Math.max(i[0],t),n=Math.max(i[1],n)),s&&(t=Math.min(s[0],t),n=Math.min(s[1],n)),this.slack=[d+(a-t),h+(l-n)],[t,n]}resizeHandler(t,n){return(r,i)=>{var s,o,a,l;let c=i.node,d=i.deltaX,h=i.deltaY;t==="onResizeStart"&&this.resetData();const f=(this.props.axis==="both"||this.props.axis==="x")&&n!=="n"&&n!=="s",m=(this.props.axis==="both"||this.props.axis==="y")&&n!=="e"&&n!=="w";if(!f&&!m)return;const p=n[0],y=n[n.length-1],b=c.getBoundingClientRect();if(this.lastHandleRect!=null){if(y==="w"){const j=b.left-this.lastHandleRect.left;d+=j}if(p==="n"){const j=b.top-this.lastHandleRect.top;h+=j}}this.lastHandleRect=b,y==="w"&&(d=-d),p==="n"&&(h=-h);const _=(s=(o=this.lastSize)==null?void 0:o.width)!=null?s:this.props.width,v=(a=(l=this.lastSize)==null?void 0:l.height)!=null?a:this.props.height;let g=_+(f?d/this.props.transformScale:0),S=v+(m?h/this.props.transformScale:0);var k=this.runConstraints(g,S);if(g=k[0],S=k[1],t==="onResizeStop"&&this.lastSize){var x=this.lastSize;g=x.width,S=x.height}const T=g!==_||S!==v;t!=="onResizeStop"&&(this.lastSize={width:g,height:S});const L=typeof this.props[t]=="function"?this.props[t]:null;L&&!(t==="onResize"&&!T)&&(r.persist==null||r.persist(),L(r,{node:c,size:{width:g,height:S},handle:n})),t==="onResizeStop"&&this.resetData()}}renderResizeHandle(t,n){const r=this.props.handle;if(!r)return ys.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+t,ref:n});if(typeof r=="function")return r(t,n);const i=typeof r.type=="string",s=sh({ref:n},i?{}:{handleAxis:t});return ys.cloneElement(r,s)}render(){const t=this.props,n=t.children,r=t.className,i=t.draggableOpts;t.width,t.height,t.handle,t.handleSize,t.lockAspectRatio,t.axis,t.minConstraints,t.maxConstraints,t.onResize,t.onResizeStop,t.onResizeStart;const s=t.resizeHandles;t.transformScale;const o=XL(t,GL);return(0,KL.cloneElement)(n,sh(sh({},o),{},{className:(r?r+" ":"")+"react-resizable",children:[...ys.Children.toArray(n.props.children),...s.map(a=>{var l;const c=(l=this.handleRefs[a])!=null?l:this.handleRefs[a]=ys.createRef();return ys.createElement(qL.DraggableCore,Ld({},i,{nodeRef:c,key:"resizableHandle-"+a,onStop:this.resizeHandler("onResizeStop",a),onStart:this.resizeHandler("onResizeStart",a),onDrag:this.resizeHandler("onResize",a)}),this.renderResizeHandle(a,c))})]}))}};Ra.default=Xp;Xp.propTypes=YL.resizableProps;Xp.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var nu={};nu.__esModule=!0;nu.default=void 0;var oh=GS(w),eA=YS(qp),tA=YS(Ra),nA=Ta;const rA=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function YS(e){return e&&e.__esModule?e:{default:e}}function GS(e,t){if(typeof WeakMap=="function")var n=new WeakMap,r=new WeakMap;return(GS=function(i,s){if(!s&&i&&i.__esModule)return i;var o,a,l={__proto__:null,default:i};if(i===null||typeof i!="object"&&typeof i!="function")return l;if(o=s?r:n){if(o.has(i))return o.get(i);o.set(i,l)}for(const c in i)c!=="default"&&{}.hasOwnProperty.call(i,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(i,c))&&(a.get||a.set)?o(l,c,a):l[c]=i[c]);return l})(e,t)}function Ad(){return Ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ad.apply(null,arguments)}function Oy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function bc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Oy(Object(n),!0).forEach(function(r){iA(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oy(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iA(e,t,n){return(t=sA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sA(e){var t=oA(e,"string");return typeof t=="symbol"?t:t+""}function oA(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function aA(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}class XS extends oh.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(t,n)=>{const r=n.size;this.props.onResize?(t.persist==null||t.persist(),this.setState(r,()=>this.props.onResize&&this.props.onResize(t,n))):this.setState(r)}}static getDerivedStateFromProps(t,n){return n.propsWidth!==t.width||n.propsHeight!==t.height?{width:t.width,height:t.height,propsWidth:t.width,propsHeight:t.height}:null}render(){const t=this.props,n=t.handle,r=t.handleSize;t.onResize;const i=t.onResizeStart,s=t.onResizeStop,o=t.draggableOpts,a=t.minConstraints,l=t.maxConstraints,c=t.lockAspectRatio,d=t.axis;t.width,t.height;const h=t.resizeHandles,f=t.style,m=t.transformScale,p=aA(t,rA);return oh.createElement(tA.default,{axis:d,draggableOpts:o,handle:n,handleSize:r,height:this.state.height,lockAspectRatio:c,maxConstraints:l,minConstraints:a,onResizeStart:i,onResize:this.onResize,onResizeStop:s,resizeHandles:h,transformScale:m,width:this.state.width},oh.createElement("div",Ad({},p,{style:bc(bc({},f),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}}nu.default=XS;XS.propTypes=bc(bc({},nA.resizableProps),{},{children:eA.default.element});Yp.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};var lA=Yp.exports.Resizable=Ra.default;Yp.exports.ResizableBox=nu.default;function JS(e){return function(n,r,i,s,o,a,l){return e(n,r,l)}}function ru(e){return function(n,r,i,s){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i,s);var o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);var l=e(n,r,i,s);return s.delete(n),s.delete(r),l}}function ZS(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function zy(e){return e.constructor===Object||e.constructor==null}function By(e){return typeof e.then=="function"}function iu(e,t){return e===t||e!==e&&t!==t}var cA="[object Arguments]",uA="[object Boolean]",hA="[object Date]",dA="[object RegExp]",fA="[object Map]",pA="[object Number]",mA="[object Object]",gA="[object Set]",yA="[object String]",Fy=Object.prototype.toString;function su(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,i=e.areObjectsEqual,s=e.areRegExpsEqual,o=e.areSetsEqual,a=e.createIsNestedEqual,l=a(c);function c(d,h,f){if(d===h)return!0;if(!d||!h||typeof d!="object"||typeof h!="object")return d!==d&&h!==h;if(zy(d)&&zy(h))return i(d,h,l,f);var m=Array.isArray(d),p=Array.isArray(h);if(m||p)return m===p&&t(d,h,l,f);var y=Fy.call(d);return y!==Fy.call(h)?!1:y===hA?n(d,h,l,f):y===dA?s(d,h,l,f):y===fA?r(d,h,l,f):y===gA?o(d,h,l,f):y===mA||y===cA?By(d)||By(h)?!1:i(d,h,l,f):y===uA||y===pA||y===yA?iu(d.valueOf(),h.valueOf()):!1}return c}function QS(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-- >0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var _A=ru(QS);function ex(e,t){return iu(e.valueOf(),t.valueOf())}function tx(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var s={},o=0;return e.forEach(function(a,l){if(i){var c=!1,d=0;t.forEach(function(h,f){!c&&!s[d]&&(c=n(l,f,o,d,e,t,r)&&n(a,h,l,f,e,t,r))&&(s[d]=!0),d++}),o++,i=c}}),i}var vA=ru(tx),bA="_owner",wA=Object.prototype.hasOwnProperty;function nx(e,t,n,r){var i=Object.keys(e),s=i.length;if(Object.keys(t).length!==s)return!1;for(var o;s-- >0;){if(o=i[s],o===bA){var a=!!e.$$typeof,l=!!t.$$typeof;if((a||l)&&a!==l)return!1}if(!wA.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var SA=ru(nx);function rx(e,t){return e.source===t.source&&e.flags===t.flags}function ix(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var s={};return e.forEach(function(o,a){if(i){var l=!1,c=0;t.forEach(function(d,h){!l&&!s[c]&&(l=n(o,d,a,h,e,t,r))&&(s[c]=!0),c++}),i=l}}),i}var xA=ru(ix),sx=Object.freeze({areArraysEqual:QS,areDatesEqual:ex,areMapsEqual:tx,areObjectsEqual:nx,areRegExpsEqual:rx,areSetsEqual:ix,createIsNestedEqual:JS}),ox=Object.freeze({areArraysEqual:_A,areDatesEqual:ex,areMapsEqual:vA,areObjectsEqual:SA,areRegExpsEqual:rx,areSetsEqual:xA,createIsNestedEqual:JS}),kA=su(sx);function zr(e,t){return kA(e,t,void 0)}su(ZS(sx,{createIsNestedEqual:function(){return iu}}));su(ox);su(ZS(ox,{createIsNestedEqual:function(){return iu}}));function $y(e){const{children:t,cols:n,containerWidth:r,margin:i,containerPadding:s,rowHeight:o,maxRows:a,isDraggable:l,isResizable:c,isBounded:d,static:h,useCSSTransforms:f=!0,usePercentages:m=!1,transformScale:p=1,positionStrategy:y,dragThreshold:b=0,droppingPosition:_,className:v="",style:g,handle:S="",cancel:k="",x,y:T,w:L,h:B,minW:j=1,maxW:F=1/0,minH:A=1,maxH:R=1/0,i:P,resizeHandles:N,resizeHandle:O,constraints:W=AS,layoutItem:D,layout:I=[],onDragStart:C,onDrag:X,onDragStop:ie,onResizeStart:E,onResize:ue,onResizeStop:ve}=e,[Z,pe]=w.useState(!1),[ce,ge]=w.useState(!1),Pe=w.useRef(null),we=w.useRef({left:0,top:0}),Be=w.useRef({top:0,left:0,width:0,height:0}),be=w.useRef(void 0),Ue=w.useRef(I);Ue.current=I;const M=w.useRef(null),ae=w.useRef(null),re=w.useRef(!1),Ee=w.useRef({x:0,y:0}),G=w.useRef(!1),se=w.useMemo(()=>({cols:n,containerPadding:s,containerWidth:r,margin:i,maxRows:a,rowHeight:o}),[n,s,r,i,a,o]),ke=w.useMemo(()=>({cols:n,maxRows:a,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,a,r,o,i]),$e=w.useCallback(()=>({...ke,layout:Ue.current}),[ke]),Ve=w.useMemo(()=>D??{i:P,x,y:T,w:L,h:B,minW:j,maxW:F,minH:A,maxH:R},[D,P,x,T,L,B,j,F,A,R]),St=w.useCallback(Ye=>{if(y!=null&&y.calcStyle)return y.calcStyle(Ye);if(f)return Fp(Ye);const qe=IS(Ye);return m?{...qe,left:Ey(Ye.left/r),width:Ey(Ye.width/r)}:qe},[y,f,m,r]),mt=w.useCallback((Ye,{node:qe})=>{if(!C)return;const{offsetParent:Fe}=qe;if(!Fe)return;const Je=Fe.getBoundingClientRect(),dt=qe.getBoundingClientRect(),kt=dt.left/p,Ct=Je.left/p,Et=dt.top/p,H=Je.top/p;let le;if(y!=null&&y.calcDragPosition){const Se=Ye;le=y.calcDragPosition(Se.clientX,Se.clientY,Se.clientX-dt.left,Se.clientY-dt.top)}else le={left:kt-Ct+Fe.scrollLeft,top:Et-H+Fe.scrollTop};if(we.current=le,b>0){const Se=Ye;Ee.current={x:Se.clientX,y:Se.clientY},re.current=!0,G.current=!1,pe(!0);return}pe(!0);const he=sl(se,le.top,le.left),{x:Ce,y:ne}=ol(W,Ve,he.x,he.y,$e());C(P,Ce,ne,{e:Ye,node:qe,newPosition:le})},[C,p,se,y,b,W,Ve,$e,P]),z=w.useCallback((Ye,{node:qe,deltaX:Fe,deltaY:Je})=>{if(!X||!Z)return;const dt=Ye;if(re.current&&!G.current){const Ce=dt.clientX-Ee.current.x,ne=dt.clientY-Ee.current.y;if(Math.hypot(Ce,ne)<b)return;if(G.current=!0,re.current=!1,C){const de=sl(se,we.current.top,we.current.left),{x:Te,y:Ne}=ol(W,Ve,de.x,de.y,$e());C(P,Te,Ne,{e:Ye,node:qe,newPosition:we.current})}}let kt=we.current.top+Je,Ct=we.current.left+Fe;if(d){const{offsetParent:Ce}=qe;if(Ce){const ne=Ce.clientHeight-kr(B,o,i[1]);kt=_c(kt,0,ne);const Se=os(se),de=r-kr(L,Se,i[0]);Ct=_c(Ct,0,de)}}const Et={top:kt,left:Ct};we.current=Et;const H=sl(se,kt,Ct),{x:le,y:he}=ol(W,Ve,H.x,H.y,$e());X(P,le,he,{e:Ye,node:qe,newPosition:Et})},[X,C,Z,b,d,B,o,i,se,r,L,P,W,Ve,$e]),q=w.useCallback((Ye,{node:qe})=>{if(!ie||!Z)return;const Fe=re.current;if(re.current=!1,G.current=!1,Ee.current={x:0,y:0},Fe){pe(!1),we.current={left:0,top:0};return}const{left:Je,top:dt}=we.current,kt={top:dt,left:Je};pe(!1),we.current={left:0,top:0};const Ct=sl(se,dt,Je),{x:Et,y:H}=ol(W,Ve,Ct.x,Ct.y,$e());ie(P,Et,H,{e:Ye,node:qe,newPosition:kt})},[ie,Z,se,W,Ve,$e,P]);M.current=mt,ae.current=z;const _e=w.useCallback((Ye,{node:qe,size:Fe,handle:Je},dt,kt)=>{const Ct=kt==="onResizeStart"?E:kt==="onResize"?ue:ve;if(!Ct)return;let Et;qe?Et=ZP(Je,dt,Fe,r):Et={...Fe,top:dt.top,left:dt.left},Be.current=Et;const H=zP(se,Et.width,Et.height),{w:le,h:he}=UP(W,Ve,H.w,H.h,Je,$e());Ct(P,le,he,{e:Ye.nativeEvent,node:qe,size:Et,handle:Je})},[E,ue,ve,r,se,P,W,Ve,$e]),Q=w.useCallback((Ye,qe)=>{ge(!0);const Fe=il(se,x,T,L,B),Je={...qe,handle:qe.handle};_e(Ye,Je,Fe,"onResizeStart")},[_e,se,x,T,L,B]),Re=w.useCallback((Ye,qe)=>{const Fe=il(se,x,T,L,B),Je={...qe,handle:qe.handle};_e(Ye,Je,Fe,"onResize")},[_e,se,x,T,L,B]),rt=w.useCallback((Ye,qe)=>{ge(!1),Be.current={top:0,left:0,width:0,height:0};const Fe=il(se,x,T,L,B),Je={...qe,handle:qe.handle};_e(Ye,Je,Fe,"onResizeStop")},[_e,se,x,T,L,B]);w.useEffect(()=>{var Je,dt;if(!_)return;const Ye=Pe.current;if(!Ye)return;const qe=be.current||{left:0,top:0},Fe=Z&&(_.left!==qe.left||_.top!==qe.top);if(Z){if(Fe){const kt=_.left-we.current.left,Ct=_.top-we.current.top,Et={node:Ye,deltaX:kt,deltaY:Ct,lastX:we.current.left,lastY:we.current.top,x:_.left,y:_.top};(dt=ae.current)==null||dt.call(ae,_.e,Et)}}else{const kt={node:Ye,deltaX:_.left,deltaY:_.top,lastX:0,lastY:0,x:_.left,y:_.top};(Je=M.current)==null||Je.call(M,_.e,kt)}be.current=_},[_,Z,P]);const at=il(se,x,T,L,B,Z?we.current:null,ce?Be.current:null),Tt=mr.Children.only(t),tn=os(se),Ft=[kr(j,tn,i[0]),kr(A,o,i[1])],xt=[kr(F,tn,i[0]),kr(R,o,i[1])],lt=Tt.props,It=lt.className,Ln=lt.style;let An=mr.cloneElement(Tt,{ref:Pe,className:ao("react-grid-item",It,v,{static:h,resizing:ce,"react-draggable":l,"react-draggable-dragging":Z,dropping:!!_,cssTransforms:f}),style:{...g,...Ln,...St(at)}});const sr=O;return An=u.jsx(lA,{draggableOpts:{disabled:!c},className:c?void 0:"react-resizable-hide",width:at.width,height:at.height,minConstraints:Ft,maxConstraints:xt,onResizeStart:Q,onResize:Re,onResizeStop:rt,transformScale:p,resizeHandles:N,handle:sr,children:An}),An=u.jsx(Di,{disabled:!l,onStart:mt,onDrag:z,onStop:q,handle:S,cancel:".react-resizable-handle"+(k?","+k:""),scale:p,nodeRef:Pe,children:An}),An}var Ar=()=>{},Hy="react-grid-layout",ax=!1;try{ax=/firefox/i.test(navigator.userAgent)}catch{}function CA(e,t){const n=mr.Children.toArray(e),r=mr.Children.toArray(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const s=n[i],o=r[i];if((s==null?void 0:s.key)!==(o==null?void 0:o.key))return!1}return!0}function Wy(e,t,n,r){const i=[],s=new Set;mr.Children.forEach(t,a=>{if(!mr.isValidElement(a)||a.key===null)return;const l=String(a.key);s.add(l);const c=e.find(d=>d.i===l);if(c)i.push(as(c));else{const h=a.props["data-grid"];h?i.push({i:l,x:h.x??0,y:h.y??0,w:h.w??1,h:h.h??1,minW:h.minW,maxW:h.maxW,minH:h.minH,maxH:h.maxH,static:h.static,isDraggable:h.isDraggable,isResizable:h.isResizable,resizeHandles:h.resizeHandles,isBounded:h.isBounded}):i.push({i:l,x:0,y:Zc(i),w:1,h:1})}});const o=Bp(i,{cols:n});return r.compact(o,n)}function EA(e){const{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:s,dropConfig:o,positionStrategy:a=tL,compactor:l,constraints:c=AS,layout:d=[],droppingItem:h,autoSize:f=!0,className:m="",style:p={},innerRef:y,onLayoutChange:b=Ar,onDragStart:_=Ar,onDrag:v=Ar,onDragStop:g=Ar,onResizeStart:S=Ar,onResize:k=Ar,onResizeStop:x=Ar,onDrop:T=Ar,onDropDragOver:L=Ar}=e,B=w.useMemo(()=>({...nL,...r}),[r]),j=w.useMemo(()=>({...rL,...i}),[i]),F=w.useMemo(()=>({...iL,...s}),[s]),A=w.useMemo(()=>({...sL,...o}),[o]),{cols:R,rowHeight:P,maxRows:N,margin:O,containerPadding:W}=B,{enabled:D,bounded:I,handle:C,cancel:X,threshold:ie}=j,{enabled:E,handles:ue,handleComponent:ve}=F,{enabled:Z,defaultItem:pe,onDragOver:ce}=A,ge=l??eu("vertical"),Pe=ge.type,we=ge.allowOverlap,Be=ge.preventCollision??!1,be=w.useMemo(()=>h??{i:"__dropping-elem__",...pe},[h,pe]),Ue=a.type==="transform",M=a.scale,ae=W??O,[re,Ee]=w.useState(!1),[G,se]=w.useState(()=>Wy(d,t,R,ge)),[ke,$e]=w.useState(null),[Ve,St]=w.useState(!1),[mt,z]=w.useState(null),[q,_e]=w.useState(),Q=w.useRef(null),Re=w.useRef(null),rt=w.useRef(null),at=w.useRef(0),Tt=w.useRef(G),tn=w.useRef(d),Ft=w.useRef(t),xt=w.useRef(Pe),lt=w.useRef(G);lt.current=G,w.useEffect(()=>{Ee(!0),zr(G,d)||b(G)},[]),w.useEffect(()=>{if(ke||mt)return;const ne=!zr(d,tn.current),Se=!CA(t,Ft.current),de=Pe!==xt.current;if(ne||Se||de){const Ne=Wy(ne?d:G,t,R,ge);zr(Ne,G)||se(Ne)}tn.current=d,Ft.current=t,xt.current=Pe},[d,t,R,Pe,ge,ke,mt,G]),w.useEffect(()=>{if(!ke&&!zr(G,Tt.current)){Tt.current=G;const ne=G.filter(Se=>Se.i!==be.i);b(ne)}},[G,ke,b,be.i]);const It=w.useMemo(()=>{if(!f)return;const ne=Zc(G),Se=ae[1];return ne*P+(ne-1)*O[1]+Se*2+"px"},[f,G,P,O,ae]),Ln=w.useCallback((ne,Se,de,Te)=>{const Ne=lt.current,De=$i(Ne,ne);if(!De)return;const Ze={w:De.w,h:De.h,x:De.x,y:De.y,i:ne};Q.current=as(De),rt.current=Ne,$e(Ze),_(Ne,De,De,null,Te.e,Te.node)},[_]),An=w.useCallback((ne,Se,de,Te)=>{const Ne=lt.current,De=Q.current,Ze=$i(Ne,ne);if(!Ze)return;const gt={w:Ze.w,h:Ze.h,x:Ze.x,y:Ze.y,i:ne},tt=Yi(Ne,Ze,Se,de,!0,Be,Pe,R,we);v(tt,De,Ze,gt,Te.e,Te.node),se(ge.compact(tt,R)),$e(gt)},[Be,Pe,R,we,ge,v]),sr=w.useCallback((ne,Se,de,Te)=>{if(!ke)return;const Ne=lt.current,De=Q.current,Ze=$i(Ne,ne);if(!Ze)return;const gt=Yi(Ne,Ze,Se,de,!0,Be,Pe,R,we),tt=ge.compact(gt,R);g(tt,De,Ze,null,Te.e,Te.node);const $t=rt.current;Q.current=null,rt.current=null,$e(null),se(tt),$t&&!zr($t,tt)&&b(tt)},[ke,Be,Pe,R,we,ge,g,b]),Ye=w.useCallback((ne,Se,de,Te)=>{const Ne=lt.current,De=$i(Ne,ne);De&&(Re.current=as(De),rt.current=Ne,St(!0),S(Ne,De,De,null,Te.e,Te.node))},[S]),qe=w.useCallback((ne,Se,de,Te)=>{const Ne=lt.current,De=Re.current,{handle:Ze}=Te;let gt=!1,tt,$t;const[Pi,qn]=$P(Ne,ne,it=>(tt=it.x,$t=it.y,["sw","w","nw","n","ne"].includes(Ze)&&(["sw","nw","w"].includes(Ze)&&(tt=it.x+(it.w-Se),Se=it.x!==tt&&tt<0?it.w:Se,tt=tt<0?0:tt),["ne","n","nw"].includes(Ze)&&($t=it.y+(it.h-de),de=it.y!==$t&&$t<0?it.h:de,$t=$t<0?0:$t),gt=!0),Be&&!we&&PS(Ne,{...it,w:Se,h:de,x:tt??it.x,y:$t??it.y}).filter(ee=>ee.i!==it.i).length>0&&($t=it.y,de=it.h,tt=it.x,Se=it.w,gt=!1),it.w=Se,it.h=de,it));if(!qn)return;let Zr=Pi;gt&&tt!==void 0&&$t!==void 0&&(Zr=Yi(Pi,qn,tt,$t,!0,Be,Pe,R,we));const Li={w:qn.w,h:qn.h,x:qn.x,y:qn.y,i:ne,static:!0};k(Zr,De,qn,Li,Te.e,Te.node),se(ge.compact(Zr,R)),$e(Li)},[Be,Pe,R,we,ge,k]),Fe=w.useCallback((ne,Se,de,Te)=>{const Ne=lt.current,De=Re.current,Ze=$i(Ne,ne),gt=ge.compact(Ne,R);x(gt,De,Ze??null,null,Te.e,Te.node);const tt=rt.current;Re.current=null,rt.current=null,$e(null),St(!1),se(gt),tt&&!zr(tt,gt)&&b(gt)},[R,ge,x,b]),Je=w.useCallback(()=>{const ne=lt.current;if(!ne.some(Te=>Te.i===be.i)){z(null),$e(null),_e(void 0);return}const de=ge.compact(ne.filter(Te=>Te.i!==be.i),R);se(de),z(null),$e(null),_e(void 0)},[be.i,R,ge]),dt=w.useCallback(ne=>{var oe;if(ne.preventDefault(),ne.stopPropagation(),ax&&!((oe=ne.nativeEvent.target)!=null&&oe.classList.contains(Hy)))return!1;const Se=ce?ce(ne.nativeEvent):L(ne);if(Se===!1)return mt&&Je(),!1;const{dragOffsetX:de=0,dragOffsetY:Te=0,...Ne}=Se??{},De={...be,...Ne},Ze=ne.currentTarget.getBoundingClientRect(),gt={cols:R,margin:O,maxRows:N,rowHeight:P,containerWidth:n,containerPadding:ae},tt=os(gt),$t=kr(De.w,tt,O[0]),Pi=kr(De.h,P,O[1]),qn=$t/2,Zr=Pi/2,Li=ne.clientX-Ze.left+de-qn,it=ne.clientY-Ze.top+Te-Zr,$=Math.max(0,Li),ee=Math.max(0,it),K={left:$/M,top:ee/M,e:ne.nativeEvent};if(mt)q&&(q.left!==K.left||q.top!==K.top)&&_e(K);else{const ye=OP(gt,ee,$,De.w,De.h);z(u.jsx("div",{},De.i)),_e(K);const Ke=lt.current.filter(Me=>Me.i!==De.i);se([...Ke,{...De,x:ye.x,y:ye.y,static:!1,isDraggable:!0}])}},[mt,q,be,ce,L,Je,M,R,O,N,P,n,ae]),kt=w.useCallback(ne=>{ne.preventDefault(),ne.stopPropagation(),at.current--,at.current<0&&(at.current=0),at.current===0&&Je()},[Je]),Ct=w.useCallback(ne=>{ne.preventDefault(),ne.stopPropagation(),at.current++},[]),Et=w.useCallback(ne=>{ne.preventDefault(),ne.stopPropagation();const Se=lt.current,de=Se.find(Te=>Te.i===be.i);at.current=0,Je(),T(Se,de,ne.nativeEvent)},[be.i,Je,T]),H=w.useCallback((ne,Se)=>{if(!ne||!ne.key)return null;const de=$i(G,String(ne.key));if(!de)return null;const Te=typeof de.isDraggable=="boolean"?de.isDraggable:!de.static&&D,Ne=typeof de.isResizable=="boolean"?de.isResizable:!de.static&&E,De=de.resizeHandles||[...ue],Ze=Te&&I&&de.isBounded!==!1,gt=ve;return u.jsx($y,{containerWidth:n,cols:R,margin:O,containerPadding:ae,maxRows:N,rowHeight:P,cancel:X,handle:C,onDragStart:Ln,onDrag:An,onDragStop:sr,onResizeStart:Ye,onResize:qe,onResizeStop:Fe,isDraggable:Te,isResizable:Ne,isBounded:Ze,useCSSTransforms:Ue&&re,usePercentages:!re,transformScale:M,positionStrategy:a,dragThreshold:ie,w:de.w,h:de.h,x:de.x,y:de.y,i:de.i,minH:de.minH,minW:de.minW,maxH:de.maxH,maxW:de.maxW,static:de.static,droppingPosition:Se?q:void 0,resizeHandles:De,resizeHandle:gt,constraints:c,layoutItem:de,layout:G,children:ne},de.i)},[G,n,R,O,ae,N,P,X,C,Ln,An,sr,Ye,qe,Fe,D,E,I,Ue,re,M,a,ie,q,ue,ve,c]),le=()=>ke?u.jsx($y,{w:ke.w,h:ke.h,x:ke.x,y:ke.y,i:ke.i,className:`react-grid-placeholder ${Ve?"placeholder-resizing":""}`,containerWidth:n,cols:R,margin:O,containerPadding:ae,maxRows:N,rowHeight:P,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:Ue,transformScale:M,constraints:c,layout:G,children:u.jsx("div",{})}):null,he=ao(Hy,m),Ce={height:It,...p};return u.jsxs("div",{ref:y,className:he,style:Ce,onDrop:Z?Et:void 0,onDragLeave:Z?kt:void 0,onDragEnter:Z?Ct:void 0,onDragOver:Z?dt:void 0,children:[mr.Children.map(t,ne=>mr.isValidElement(ne)?H(ne):null),Z&&mt&&H(mt,!0),le()]})}var NA={lg:1200,md:996,sm:768,xs:480,xxs:0},jA={lg:12,md:10,sm:6,xs:4,xxs:2},ah=()=>{};function RA(e,t,n,r){const i=[];mr.Children.forEach(t,o=>{if(!mr.isValidElement(o)||o.key===null)return;const a=String(o.key),l=e.find(c=>c.i===a);if(l)i.push({...l,i:a});else{const d=o.props["data-grid"];d?i.push({i:a,x:d.x??0,y:d.y??0,w:d.w??1,h:d.h??1,minW:d.minW,maxW:d.maxW,minH:d.minH,maxH:d.maxH,static:d.static,isDraggable:d.isDraggable,isResizable:d.isResizable,resizeHandles:d.resizeHandles,isBounded:d.isBounded}):i.push({i:a,x:0,y:Zc(i),w:1,h:1})}});const s=Bp(i,{cols:n});return r.compact(s,n)}function TA(e){const{children:t,width:n,breakpoint:r,breakpoints:i=NA,cols:s=jA,layouts:o={},rowHeight:a=150,maxRows:l=1/0,margin:c=[10,10],containerPadding:d=null,compactor:h,onBreakpointChange:f=ah,onLayoutChange:m=ah,onWidthChange:p=ah,...y}=e,b=h??eu("vertical"),_=b.type,v=b.allowOverlap,g=w.useMemo(()=>r??Ny(i,n),[]),S=w.useMemo(()=>jy(g,s),[g,s]),k=w.useMemo(()=>Zu(o,i,g,g,S,_),[]),[x,T]=w.useState(g),[L,B]=w.useState(S),[j,F]=w.useState(k),[A,R]=w.useState(o),P=w.useRef(n),N=w.useRef(r),O=w.useRef(i),W=w.useRef(s),D=w.useRef(o),I=w.useRef(_),C=w.useRef(A);w.useEffect(()=>{C.current=A},[A]);const X=w.useMemo(()=>zr(o,D.current)?null:Zu(o,i,x,x,L,b),[o,i,x,L,b]),ie=X??j;w.useEffect(()=>{X!==null&&(F(X),R(o),C.current=o,D.current=o)},[X,o]),w.useEffect(()=>{if(_!==I.current){const pe=b.compact(Ei(ie),L),ce={...C.current,[x]:pe};F(pe),R(ce),C.current=ce,m(pe,ce),I.current=_}},[_,b,ie,L,v,x,m]),w.useEffect(()=>{const pe=n!==P.current,ce=r!==N.current,ge=!zr(i,O.current),Pe=!zr(s,W.current);if(pe||ce||ge||Pe){const we=r??Ny(i,n),Be=jy(we,s),be=x;if(be!==we||ge||Pe){const ae={...C.current};ae[be]||(ae[be]=Ei(j));let re=Zu(ae,i,we,be,Be,b);re=RA(re,t,Be,b),ae[we]=re,T(we),B(Be),F(re),R(ae),C.current=ae,f(we,Be),m(re,ae)}const Ue=al(c,we),M=d?al(d,we):null;p(n,Ue,Be,M),P.current=n,N.current=r,O.current=i,W.current=s}},[n,r,i,s,x,L,j,t,b,_,v,c,d,f,m,p]);const E=w.useCallback(pe=>{const ge={...C.current,[x]:pe};F(pe),R(ge),C.current=ge,m(pe,ge)},[x,m]),ue=w.useMemo(()=>al(c,x),[c,x]),ve=w.useMemo(()=>d===null?null:al(d,x),[d,x]),Z=w.useMemo(()=>({cols:L,rowHeight:a,maxRows:l,margin:ue,containerPadding:ve}),[L,a,l,ue,ve]);return u.jsx(EA,{...y,width:n,gridConfig:Z,compactor:b,onLayoutChange:E,layout:ie,children:t})}function lx(e){const{children:t,width:n,breakpoint:r,breakpoints:i,cols:s,layouts:o,onBreakpointChange:a,onLayoutChange:l,onWidthChange:c,rowHeight:d,maxRows:h,margin:f,containerPadding:m,droppingItem:p,compactType:y,preventCollision:b=!1,allowOverlap:_=!1,verticalCompact:v,isDraggable:g=!0,isBounded:S=!1,draggableHandle:k,draggableCancel:x,isResizable:T=!0,resizeHandles:L=["se"],resizeHandle:B,isDroppable:j=!1,useCSSTransforms:F=!0,transformScale:A=1,autoSize:R,className:P,style:N,innerRef:O,onDragStart:W,onDrag:D,onDragStop:I,onResizeStart:C,onResize:X,onResizeStop:ie,onDrop:E,onDropDragOver:ue}=e;let ve=y===void 0?"vertical":y;v===!1&&(ve=null);const Z={enabled:g,bounded:S,handle:k,cancel:x},pe={enabled:T,handles:L,handleComponent:B},ce={enabled:j};let ge;F?A!==1?ge=eL(A):ge=OS:ge=QP;const Pe=eu(ve,_,b);return u.jsx(TA,{width:n,breakpoint:r,breakpoints:i,cols:s,layouts:o,rowHeight:d,maxRows:h,margin:f,containerPadding:m,compactor:Pe,dragConfig:Z,resizeConfig:pe,dropConfig:ce,positionStrategy:ge,droppingItem:p,autoSize:R,className:P,style:N,innerRef:O,onBreakpointChange:a,onLayoutChange:l,onWidthChange:c,onDragStart:W,onDrag:D,onDragStop:I,onResizeStart:C,onResize:X,onResizeStop:ie,onDrop:E,onDropDragOver:ue,children:t})}lx.displayName="ResponsiveReactGridLayout";var DA=lx,PA="react-grid-layout";function LA(e){function t(n){const{measureBeforeMount:r=!1,className:i,style:s,...o}=n,[a,l]=w.useState(1280),[c,d]=w.useState(!1),h=w.useRef(null),f=w.useRef(null);return w.useEffect(()=>{d(!0)},[]),w.useEffect(()=>{const m=h.current;if(!(m instanceof HTMLElement))return;let p=null;const y=new ResizeObserver(b=>{if(b[0]){const _=b[0].contentRect.width;p!==null&&cancelAnimationFrame(p),p=requestAnimationFrame(()=>{l(_),p=null})}});return y.observe(m),f.current=y,()=>{p!==null&&cancelAnimationFrame(p),y.unobserve(m),y.disconnect()}},[c]),r&&!c?u.jsx("div",{className:ao(i,PA),style:s,ref:h}):u.jsx(e,{innerRef:h,className:i,style:s,...o,width:a})}return t.displayName=`WidthProvider(${e.displayName||e.name||"Component"})`,t}const AA=LA(DA),IA={lg:12,xxs:1},MA={lg:640,xxs:0},Uy=12,Id=20,Ll=16;function OA(e){const t=e-Id*2-(Uy-1)*Ll;return Math.max(16,t/Uy)}function zA({blocks:e,layouts:t,mode:n,onLayoutChange:r,renderBlock:i,blockMeta:s,onRemove:o,onDuplicate:a,canRemove:l=()=>!0,canDuplicate:c=()=>!0}){const d=n==="layout",h=w.useRef(null),[f,m]=w.useState(46);return w.useLayoutEffect(()=>{const p=h.current;if(!p)return;const y=()=>m(OA(p.clientHeight));if(y(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(y);return b.observe(p),()=>b.disconnect()},[]),u.jsx("div",{ref:h,className:`block-canvas ${d?"arranging":""}`,style:{"--row-pitch":`${f+Ll}px`},"data-testid":"block-canvas",children:u.jsx(AA,{className:"rgl",layouts:t,breakpoints:MA,cols:IA,rowHeight:f,margin:[Ll,Ll],containerPadding:[Id,Id],isDraggable:d,isResizable:d,draggableHandle:".block-handle",onLayoutChange:(p,y)=>r(y),compactType:"vertical",useCSSTransforms:!0,children:e.map(p=>{const y=s(p);return u.jsxs("div",{className:`block ${d?"is-arranging":""}`,"data-testid":`block-${p.type}`,"data-rgl-id":p.id,children:[u.jsxs("div",{className:`block-header ${d?"block-handle":""}`,children:[u.jsx("span",{className:"block-icon",children:y.icon}),u.jsx("span",{className:"block-title",children:y.title}),u.jsx("span",{className:"spacer"}),d&&u.jsxs("span",{className:"block-actions",children:[c(p)&&u.jsx("button",{title:"Duplicate",onClick:()=>a(p.id),"data-testid":"block-duplicate",children:"⧉"}),l(p)?u.jsx("button",{title:"Remove",onClick:()=>o(p.id),"data-testid":"block-remove",children:"✕"}):u.jsx("span",{className:"block-pin",title:"Chat is always here",children:"📌"})]})]}),u.jsx("div",{className:"block-body",children:i(p)})]},p.id)})})})}function BA({blocks:e,activeId:t,setActiveId:n,mode:r,renderBlock:i,blockMeta:s,onRemove:o,canRemove:a=()=>!0}){const l=e.find(d=>d.id===t)||e[0],c=r==="layout";return u.jsxs("div",{className:"mobile-canvas","data-testid":"mobile-canvas",children:[u.jsx("div",{className:"mobile-tabs","data-testid":"mobile-tabs",children:e.map(d=>{const h=s(d);return u.jsxs("button",{className:`mtab ${d.id===(l==null?void 0:l.id)?"active":""}`,onClick:()=>n(d.id),"data-testid":`mtab-${d.type}`,children:[u.jsx("span",{className:"mtab-icon",children:h.icon}),u.jsx("span",{className:"mtab-label",children:h.title}),c&&a(d)&&u.jsx("span",{className:"mtab-x",role:"button",title:"Remove",onClick:f=>{f.stopPropagation(),o(d.id)},children:"✕"})]},d.id)})}),u.jsx("div",{className:"mobile-block",children:l&&u.jsx("div",{className:"block",children:u.jsx("div",{className:"block-body",children:i(l)})})})]})}function FA({items:e,bazaarItems:t=[],onAdd:n,onClose:r}){return u.jsx("div",{className:"modal-backdrop",onClick:r,"data-testid":"add-gallery-backdrop",children:u.jsxs("div",{className:"modal add-gallery",onClick:i=>i.stopPropagation(),"data-testid":"add-gallery",children:[u.jsx("h2",{children:"Add a block"}),u.jsx("p",{className:"muted",children:"Build your space — drop in whatever's useful. Move and resize it however you like."}),u.jsx("div",{className:"gallery-grid",children:e.map(i=>u.jsxs("button",{className:"gallery-item",disabled:i.soon,onClick:()=>!i.soon&&n(i.type),"data-testid":`gallery-add-${i.type}`,children:[u.jsx("span",{className:"gallery-glyph",children:i.icon}),u.jsx("span",{className:"gallery-name",children:i.title}),u.jsx("span",{className:"gallery-desc",children:i.desc}),i.soon&&u.jsx("span",{className:"gallery-soon",children:"soon"})]},i.type))}),t.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gallery-section",children:"🛍️ from the Bazaar"}),u.jsx("div",{className:"gallery-grid",children:t.map(i=>u.jsxs("button",{className:"gallery-item bazaar",onClick:()=>n(i.type),"data-testid":`gallery-add-${i.type}`,children:[u.jsx("span",{className:"gallery-glyph",children:i.icon}),u.jsx("span",{className:"gallery-name",children:i.title}),u.jsx("span",{className:"gallery-desc",children:i.desc})]},i.type))})]}),u.jsxs("div",{className:"gallery-agent-hint","data-testid":"gallery-agent-hint",children:["✨ Or ask your agent in chat — ",u.jsx("em",{children:"“make me a block that shows today’s signups”"})," — and it builds one for you."]}),u.jsx("div",{className:"actions",children:u.jsx("button",{onClick:r,children:"Done"})})]})})}const $A={chat:{icon:"🗨️",label:"Chat"},liveview:{icon:"👁️",label:"Live view"},notes:{icon:"📝",label:"Notes"},earnings:{icon:"💸",label:"Earnings"},analytics:{icon:"📊",label:"Analytics"},usage:{icon:"🔋",label:"Usage"},powers:{icon:"🧰",label:"Powers"}};function Vy({blocks:e}){return u.jsx("span",{className:"tpl-chips",children:e.map((t,n)=>{const r=$A[t.type]||{icon:"▫️",label:t.type};return u.jsxs("span",{className:"tpl-chip",title:r.label,children:[u.jsx("span",{className:"tpl-chip-icon",children:r.icon}),r.label]},n)})})}function HA({builtins:e=[],saved:t=[],onApply:n,onSaveCurrent:r,onDelete:i,onClose:s}){const[o,a]=w.useState("");function l(){const c=o.trim();c&&(r(c),a(""))}return u.jsx("div",{className:"modal-backdrop",onClick:s,"data-testid":"template-gallery-backdrop",children:u.jsxs("div",{className:"modal template-gallery",onClick:c=>c.stopPropagation(),"data-testid":"template-gallery",children:[u.jsx("h2",{children:"Start from a template"}),u.jsx("p",{className:"muted",children:"Pick a layout to start from — it swaps your current blocks for the template's. Chat always stays."}),u.jsx("div",{className:"gallery-grid",children:e.map(c=>u.jsxs("button",{className:"gallery-item template-card",onClick:()=>n(c),"data-testid":`template-${c.id}`,children:[u.jsx("span",{className:"gallery-glyph",children:c.icon}),u.jsx("span",{className:"gallery-name",children:c.name}),u.jsx("span",{className:"gallery-desc",children:c.desc}),u.jsx(Vy,{blocks:c.blocks})]},c.id))}),t.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gallery-section",children:"⭐ your templates"}),u.jsx("div",{className:"gallery-grid",children:t.map(c=>u.jsxs("div",{className:"gallery-item template-card saved","data-testid":`template-${c.id}`,children:[u.jsxs("button",{className:"tpl-apply",onClick:()=>n(c),"data-testid":`template-apply-${c.id}`,children:[u.jsx("span",{className:"gallery-glyph",children:c.icon||"⭐"}),u.jsx("span",{className:"gallery-name",children:c.name}),u.jsx(Vy,{blocks:c.blocks})]}),u.jsx("button",{className:"tpl-del",title:"Delete this template",onClick:()=>i(c.id),"data-testid":`template-delete-${c.id}`,children:"✕"})]},c.id))})]}),u.jsxs("div",{className:"tpl-save-row",children:[u.jsx("input",{className:"tpl-save-input",value:o,onChange:c=>a(c.target.value),onKeyDown:c=>c.key==="Enter"&&l(),placeholder:"Save current layout as…","data-testid":"template-save-name",maxLength:40}),u.jsx("button",{className:"primary",onClick:l,disabled:!o.trim(),"data-testid":"template-save-btn",children:"Save layout"})]}),u.jsx("div",{className:"actions",children:u.jsx("button",{onClick:s,children:"Done"})})]})})}const cx="wild:theme",Md=[{id:"cyan",name:"VentureWild",accent:"#0891b2",hot:"#0e7490"},{id:"teal",name:"Teal",accent:"#0d9488",hot:"#0f766e"},{id:"blue",name:"Blue",accent:"#2563eb",hot:"#1d4ed8"},{id:"violet",name:"Violet",accent:"#7c3aed",hot:"#6d28d9"},{id:"emerald",name:"Emerald",accent:"#059669",hot:"#047857"},{id:"amber",name:"Amber",accent:"#d97706",hot:"#b45309"},{id:"rose",name:"Rose",accent:"#e11d48",hot:"#be123c"}],WA=[{id:"light",name:"Light",glyph:"☀️",desc:"Bright & warm (default)"},{id:"dark",name:"Dark",glyph:"🌙",desc:"The venturewild.llc look"}],ux={bg:"--bg",bgElev:"--bg-elev",surface:"--surface",border:"--border",text:"--text",textMuted:"--text-muted",canvas1:"--canvas-1",canvas2:"--canvas-2",canvas3:"--canvas-3"},Al={mode:"light",accent:Md[0].accent,hot:Md[0].hot,accentManual:!1,tokens:{}};function Wr(e){if(typeof e!="string")return null;const t=e.trim();return/^#([0-9a-f]{6})$/i.test(t)?t.toLowerCase():null}function hx(e){const t=Wr(e)||"#000000";return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)]}function Jp(e,t=.16){const[n,r,i]=hx(e),s=1-t,o=a=>Math.max(0,Math.min(255,Math.round(a*s)));return`#${[o(n),o(r),o(i)].map(a=>a.toString(16).padStart(2,"0")).join("")}`}function dx(e){const[t,n,r]=hx(e).map(s=>{const o=s/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r>.42?"#08232b":"#ffffff"}function Zp(e){const t={};if(e&&typeof e=="object")for(const n of Object.keys(ux)){const r=Wr(e[n]);r&&(t[n]=r)}return t}function UA(e,t,n){const r=t&&typeof t=="object"?t:{},i=n?e.accent:Wr(r.accent)||e.accent,s=n?e.hot:Wr(r.hot)||Wr(r.accent)||e.hot;return{...e,mode:r.mode==="dark"?"dark":"light",accent:i,hot:s,tokens:Zp(r.tokens),accentManual:!0}}function VA(){try{const e=localStorage.getItem(cx);if(!e)return{...Al};const t=JSON.parse(e),n=Wr(t.accent)||Al.accent;return{mode:t.mode==="dark"?"dark":"light",accent:n,hot:Wr(t.hot)||Jp(n),accentManual:!!t.accentManual,tokens:Zp(t.tokens)}}catch{return{...Al}}}function qA(e){try{localStorage.setItem(cx,JSON.stringify(e))}catch{}}function KA(e){const t=document.documentElement;e.mode==="dark"?t.dataset.theme="dark":delete t.dataset.theme;const n=Wr(e.accent)||Al.accent;t.style.setProperty("--accent",n),t.style.setProperty("--accent-hot",Wr(e.hot)||Jp(n)),t.style.setProperty("--accent-ink",dx(n));const r=Zp(e.tokens);for(const[i,s]of Object.entries(ux))r[i]?t.style.setProperty(s,r[i]):t.style.removeProperty(s)}function YA({theme:e,onChange:t,onClose:n,onPublish:r,remixOf:i}){const[s,o]=w.useState(e.accent),[a,l]=w.useState(i?`${i.title} (remix)`:""),[c,d]=w.useState(""),[h,f]=w.useState(!1),[m,p]=w.useState(null);async function y(){var S;const g=a.trim();if(!(!g||h)){f(!0),p(null);try{const k=await r({title:g,pitch:c.trim()});k&&k.ok?p({ok:!0,text:`✓ “${((S=k.listing)==null?void 0:S.title)||g}” is on your Themes shelf.`}):p({ok:!1,text:k&&k.error?k.error:"Could not publish — try again."})}catch(k){p({ok:!1,text:k.message||"Could not publish — try again."})}finally{f(!1)}}}function b(g){t({...e,mode:g,tokens:{}})}function _(g){o(g.accent),t({...e,accent:g.accent,hot:g.hot,accentManual:!0})}function v(g){o(g),/^#([0-9a-f]{6})$/i.test(g)&&t({...e,accent:g,hot:Jp(g),accentManual:!0})}return u.jsx("div",{className:"modal-backdrop",onClick:n,"data-testid":"theme-picker-backdrop",children:u.jsxs("div",{className:"modal theme-picker",onClick:g=>g.stopPropagation(),"data-testid":"theme-picker",children:[u.jsx("h2",{children:"Make it yours"}),u.jsx("p",{className:"muted",children:"Pick a look. Changes apply live and follow you across your workspaces."}),i&&u.jsxs("p",{className:"theme-remixing muted","data-testid":"theme-remixing",children:["✦ Remixing “",i.title,"” — tweak it below, then publish it as your own."]}),u.jsx("div",{className:"theme-section",children:"Mode"}),u.jsx("div",{className:"theme-modes",children:WA.map(g=>u.jsxs("button",{className:`theme-mode ${e.mode===g.id?"active":""}`,onClick:()=>b(g.id),"data-testid":`theme-mode-${g.id}`,"aria-pressed":e.mode===g.id,children:[u.jsx("span",{className:"theme-mode-glyph",children:g.glyph}),u.jsx("span",{className:"theme-mode-name",children:g.name}),u.jsx("span",{className:"theme-mode-desc",children:g.desc})]},g.id))}),u.jsx("div",{className:"theme-section",children:"Accent"}),u.jsx("div",{className:"theme-swatches",children:Md.map(g=>{const S=e.accent.toLowerCase()===g.accent.toLowerCase();return u.jsx("button",{className:`theme-swatch ${S?"active":""}`,style:{background:g.accent,color:dx(g.accent)},onClick:()=>_(g),title:g.name,"data-testid":`theme-accent-${g.id}`,"aria-pressed":S,children:S?"✓":""},g.id)})}),u.jsxs("div",{className:"theme-custom",children:[u.jsx("label",{htmlFor:"theme-hex",className:"muted",children:"Custom"}),u.jsx("input",{id:"theme-hex",type:"color",value:/^#([0-9a-f]{6})$/i.test(s)?s:"#0891b2",onChange:g=>v(g.target.value),"data-testid":"theme-custom-color","aria-label":"Custom accent color"}),u.jsx("input",{className:"theme-hex-input",value:s,onChange:g=>v(g.target.value),placeholder:"#0891b2",maxLength:7,spellCheck:!1,"data-testid":"theme-custom-hex"})]}),r&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"theme-section",children:"Share your look"}),u.jsx("p",{className:"muted theme-publish-sub",children:"Put this theme on your Bazaar shelf so others can wear it — you earn each time they do."}),u.jsxs("div",{className:"theme-publish","data-testid":"theme-publish",children:[u.jsx("input",{className:"theme-hex-input theme-publish-title",value:a,onChange:g=>l(g.target.value),placeholder:"Name your look — e.g. Midnight Focus",maxLength:60,"data-testid":"theme-publish-title","aria-label":"Theme name"}),u.jsx("input",{className:"theme-hex-input theme-publish-pitch",value:c,onChange:g=>d(g.target.value),placeholder:"One line — what's the vibe? (optional)",maxLength:120,"data-testid":"theme-publish-pitch","aria-label":"Theme pitch"}),u.jsx("button",{className:"primary",onClick:y,disabled:!a.trim()||h,"data-testid":"theme-publish-btn",children:h?"Publishing…":"Publish my look"})]}),m&&u.jsx("p",{className:`theme-publish-msg ${m.ok?"ok":"err"}`,"data-testid":"theme-publish-msg",children:m.text})]}),u.jsx("div",{className:"actions",children:u.jsx("button",{className:"primary",onClick:n,"data-testid":"theme-done",children:"Done"})})]})})}const ll=[{tier:1,label:"Read-only (diagnostics + logs)"},{tier:2,label:"Diagnostics & fixes (recommended)"},{tier:3,label:"Operate my agent",operate:!0},{tier:4,label:"Run shell commands",operate:!0}],GA=[{minutes:30,label:"30 minutes"},{minutes:120,label:"2 hours"},{minutes:480,label:"8 hours"}];function XA(e){const t=Math.round(e/6e4);return t<=0?"expiring":t<60?`${t} min`:`${Math.floor(t/60)}h ${t%60}m`}function JA({token:e}){var v;const[t,n]=w.useState(null),[r,i]=w.useState(2),[s,o]=w.useState(30),[a,l]=w.useState(!1),[c,d]=w.useState(!1),h=w.useCallback(()=>e?{Authorization:`Bearer ${e}`}:{},[e]),f=w.useCallback(async()=>{try{const g=await fetch("/api/support/status",{headers:h()});if(!g.ok)return;n(await g.json())}catch{}},[h]);w.useEffect(()=>{f();const g=setInterval(f,1e4);return()=>clearInterval(g)},[f]);const m=w.useCallback(async()=>{var g;l(!0);try{const S=(g=ll.find(k=>k.tier===r))==null?void 0:g.operate;await fetch("/api/support/grant",{method:"POST",headers:{"content-type":"application/json",...h()},body:JSON.stringify({tier:r,minutes:s,confirmOperate:!!S})})}catch{}l(!1),f()},[h,f,r,s]),p=w.useCallback(async()=>{d(!0);try{await fetch("/api/support/revoke",{method:"POST",headers:h()})}catch{}d(!1),f()},[h,f]);if(!t||typeof t.enabled!="boolean")return null;const y=t.enabled||t.active||!!t.operate;if(!y&&!t.canGrant)return null;const b=ll.find(g=>g.tier===r),_=t.maxTier||4;return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"set-section",children:"Support access"}),y?u.jsxs("div",{className:"set-support","data-testid":"support-access",children:[u.jsxs("span",{children:["🛟 ",u.jsx("strong",{children:"Allowed"})," —"," ",((v=ll.find(g=>g.tier===t.tier))==null?void 0:v.label)||`tier ${t.tier}`,t.remainingMs>0&&u.jsxs(u.Fragment,{children:[" · auto-expires in ",XA(t.remainingMs)]})]}),u.jsx("button",{type:"button",onClick:p,disabled:c,"data-testid":"support-revoke",children:c?"Revoking…":"Revoke"})]}):u.jsxs("div",{className:"set-support","data-testid":"support-access",children:[u.jsxs("label",{children:["Let support",u.jsx("select",{"aria-label":"support level",value:r,onChange:g=>i(Number(g.target.value)),children:ll.filter(g=>g.tier<=_).map(g=>u.jsx("option",{value:g.tier,children:g.label},g.tier))})]}),u.jsxs("label",{children:["for",u.jsx("select",{"aria-label":"duration",value:s,onChange:g=>o(Number(g.target.value)),children:GA.map(g=>u.jsx("option",{value:g.minutes,children:g.label},g.minutes))})]}),(b==null?void 0:b.operate)&&u.jsxs("span",{className:"set-support-warn","data-testid":"support-operate-warn",children:["⚠ lets support ",r>=4?"run shell commands on":"operate the agent on"," your machine"]}),u.jsx("button",{type:"button",onClick:m,disabled:a,"data-testid":"support-allow",children:a?"Allowing…":"Allow"})]}),u.jsx("p",{className:"muted small",children:"Off by default and time-boxed. While it’s allowed, a banner stays on screen with a one-tap Stop/Revoke."})]})}const qy=[{id:"check",title:"Check with me",emoji:"🪧",build:!0,desc:"Your agent proposes first — it only acts after you approve. Read-only until you say go."},{id:"work",title:"Work, then show me",emoji:"🛠️",build:!1,desc:"Builds and edits freely, shows you the diff — but still confirms the risky stuff (deploy, delete, send, spend)."},{id:"full",title:"Full autonomy",emoji:"🚀",build:!0,desc:"Does everything on its own, never asks. Fastest — and the least guarded."}];function ZA({token:e,session:t,onClose:n,onOpenTheme:r}){var _,v;const[i,s]=w.useState(null),[o,a]=w.useState(""),[l,c]=w.useState(!1),d=e?{Authorization:`Bearer ${e}`}:{};w.useEffect(()=>{let g=!0;return fetch("/api/settings",{headers:d}).then(S=>S.ok?S.json():null).then(S=>{g&&S&&(s(S),a(S.conversationTitle||""))}).catch(()=>{}),()=>{g=!1}},[e]);async function h(g){const S=await fetch("/api/settings",{method:"POST",headers:{...d,"Content-Type":"application/json"},body:JSON.stringify(g)}).then(k=>k.ok?k.json():null).catch(()=>null);return S&&s(S),S}function f(g){const S=qy.find(k=>k.id===g);!S||!S.build||(s(k=>({...k||{},autonomyLevel:g})),h({autonomyLevel:g}))}async function m(){c(!0);try{await h({conversationTitle:o})}finally{c(!1)}}const p=(i==null?void 0:i.autonomyLevel)??null,y=(t==null?void 0:t.account)||null,b=((_=t==null?void 0:t.identity)==null?void 0:_.name)||((v=t==null?void 0:t.agent)==null?void 0:v.label)||"your agent";return u.jsx("div",{className:"modal-backdrop",onClick:n,"data-testid":"settings-backdrop",children:u.jsxs("div",{className:"modal settings-menu",onClick:g=>g.stopPropagation(),"data-testid":"settings-menu",children:[u.jsx("h2",{children:"Settings"}),u.jsx("p",{className:"muted",children:"The everyday knobs. Your agent handles the rest."}),u.jsx("div",{className:"set-section",children:"Permissions — what can your agent do on its own?"}),u.jsx("div",{className:"autonomy-dial","data-testid":"autonomy-dial",children:qy.map(g=>{const S=p===g.id;return u.jsxs("button",{className:`autonomy-tier ${S?"selected":""} ${g.build?"":"coming-soon"}`,onClick:()=>f(g.id),disabled:!g.build,"aria-pressed":S,"data-testid":`autonomy-${g.id}`,children:[u.jsx("span",{className:"autonomy-emoji",children:g.emoji}),u.jsxs("span",{className:"autonomy-body",children:[u.jsxs("span",{className:"autonomy-title",children:[g.title,!g.build&&u.jsx("span",{className:"autonomy-soon","data-testid":"autonomy-coming-soon",children:"coming soon"}),S&&u.jsx("span",{className:"autonomy-check",children:"✓"})]}),u.jsx("span",{className:"autonomy-desc",children:g.desc})]})]},g.id)})}),p===null&&u.jsxs("p",{className:"autonomy-note","data-testid":"autonomy-default-note",children:["Default — your agent follows the per-message ",u.jsx("strong",{children:"Build / Plan"})," toggle. Pick a setting above to lock it."]}),u.jsx("div",{className:"set-section",children:"Conversation name"}),u.jsxs("div",{className:"set-rename",children:[u.jsx("input",{type:"text",value:o,placeholder:"Auto-named from your chat",onChange:g=>a(g.target.value),"data-testid":"rename-input",maxLength:120}),u.jsx("button",{onClick:m,disabled:l,"data-testid":"rename-save",children:l?"Saving…":"Save"})]}),u.jsx("p",{className:"muted small",children:"Overrides the name we auto-pick for this workspace’s presence label."}),u.jsx("div",{className:"set-section",children:"Appearance"}),u.jsx("button",{className:"set-row",onClick:()=>{r==null||r(),n==null||n()},"data-testid":"settings-open-theme",children:"🎨 Theme — light / dark + accent"}),u.jsx(JA,{token:e}),u.jsx("div",{className:"set-section",children:"Account"}),u.jsxs("div",{className:"set-account","data-testid":"settings-account",children:[u.jsxs("span",{className:"set-account-agent",children:["Your agent: ",u.jsx("strong",{children:b})]}),y!=null&&y.email?u.jsxs("span",{className:"set-account-email",children:["Signed in as ",y.email]}):u.jsx("span",{className:"set-account-email muted",children:"Signed in on this device"})]}),u.jsx("div",{className:"actions",children:u.jsx("button",{onClick:n,"data-testid":"settings-done",children:"Done"})})]})})}function QA({bazaarPreview:e}){const[t,n]=w.useState(null);w.useEffect(()=>{let i=!1;async function s(){var c;const a=await fetch("/api/preview/ports").catch(()=>null);if(!a||i)return;const l=await a.json().catch(()=>({}));i||!t&&((c=l.ports)==null?void 0:c.length)>0&&n(l.ports[0].port)}s();const o=setInterval(s,4e3);return()=>{i=!0,clearInterval(o)}},[t]);const r=e!=null&&e.url?`${e.url}${e.url.includes("?")?"&":"?"}_=${e.ts||""}`:null;return r?u.jsx("iframe",{className:"liveview-frame",src:r,title:"Live view","data-testid":"liveview-frame",sandbox:"allow-scripts"},`bz-${e.ts}`):t?u.jsx("iframe",{className:"liveview-frame",src:`http://localhost:${t}`,title:"Live view","data-testid":"liveview-frame"},t):u.jsxs("div",{className:"liveview-empty","data-testid":"liveview-empty",children:[u.jsx("div",{className:"liveview-empty-mark",children:"👁️"}),u.jsx("p",{className:"liveview-empty-title",children:"Nothing to show yet"}),u.jsx("p",{className:"liveview-empty-sub",children:"When your agent builds something, it appears here — live, as it works."}),u.jsx(Jc,{variant:"ambient"})]})}function eI({id:e}){const t=`wild:notes:${e}`,[n,r]=w.useState(()=>{try{return localStorage.getItem(t)||""}catch{return""}});return w.useEffect(()=>{try{localStorage.setItem(t,n)}catch{}},[t,n]),u.jsx("textarea",{className:"notes-block",value:n,onChange:i=>r(i.target.value),placeholder:"Jot anything — a plan, a link, a reminder…","data-testid":"notes-block"})}function tI(e){return`$${(Number(e)||0).toFixed(2)}`}function nI(e=[],t=[]){if(!e.length)return t.length?{name:"You",handle:"you",total:0,uses:0,matches:0,serviceCalls:0}:null;const n=e[0];return(n.total||0)===0&&e.find(r=>r.handle==="you")||n}function rI({live:e,token:t}){const[n,r]=w.useState(e||null);w.useEffect(()=>{let p=!1;const y=t?{Authorization:`Bearer ${t}`}:{};return fetch("/api/bazaar/state",{headers:y}).then(b=>b.ok?b.json():null).then(b=>{!p&&b&&r(_=>_||b)}).catch(()=>{}),()=>{p=!0}},[t]),w.useEffect(()=>{e&&r(e)},[e]);const i=w.useMemo(()=>nI(n==null?void 0:n.earnings,n==null?void 0:n.listings),[n]),s=i==null?void 0:i.handle,o=(i==null?void 0:i.total)??0,a=w.useRef({handle:null,total:null}),[l,c]=w.useState([]);if(w.useEffect(()=>{const p=a.current;if(p.handle!==s){a.current={handle:s,total:o},c([]);return}if(p.total===null){a.current={handle:s,total:o};return}const y=o-p.total;a.current={handle:s,total:o},y>0&&c(b=>[...b,y].slice(-28))},[s,o]),!i)return u.jsxs("div",{className:"earn-empty","data-testid":"earnings-empty",children:[u.jsx("div",{className:"earn-empty-mark",children:"💸"}),u.jsx("p",{className:"earn-empty-title",children:"No earnings yet"}),u.jsx("p",{className:"earn-empty-sub",children:"When someone builds on what you share — or uses a tool you wired in — represented earnings show up here, live."})]});const d=i.handle==="you",h=(i.serviceCalls||0)>0||(i.matches||0)>0,f=h?i.matches||0:i.uses||0,m=h?f===1?"match":"matches":f===1?"build":"builds";return u.jsxs("div",{className:"earn-block","data-testid":"earnings-block",children:[u.jsxs("div",{className:"earn-who",children:[u.jsxs("span",{className:"earn-name",children:[i.name,d&&u.jsx("span",{className:"earn-you-tag",children:"you"})]}),u.jsx("span",{className:"earn-sub",children:d?"your producer earnings":"a producer's earnings, live"})]}),u.jsx("div",{className:"earn-amount","data-testid":"earnings-amount",children:tI(o)}),u.jsxs("div",{className:"earn-meta",children:[u.jsxs("span",{children:[u.jsx("strong",{children:f})," ",m]}),u.jsx("span",{className:"earn-rep",title:"No real money moves yet — a preview of how earnings would work.",children:"represented · settles later"})]}),u.jsx(iI,{values:l})]})}function iI({values:e}){const t=e&&e.length>0,n=t?e:Array.from({length:16},()=>0),r=t?Math.max(...e):1;return u.jsxs("div",{className:`earn-spark ${t?"":"is-baseline"}`,"data-testid":"earnings-spark","aria-hidden":"true",children:[u.jsx("div",{className:"earn-bars",children:n.map((i,s)=>u.jsx("span",{className:"earn-bar",style:{height:`${t?8+Math.round(i/r*92):6}%`}},s))}),u.jsx("span",{className:"earn-spark-live",children:"live"})]})}function fx(e){const t=Math.max(0,Math.min(100,Number(e)||0));return Math.round(t)}function Ky(e,t){if(!e)return"";const n=Date.parse(e);if(!Number.isFinite(n))return"";let r=Math.floor((n-t)/1e3);if(r<=0)return"resetting…";const i=Math.floor(r/86400);r-=i*86400;const s=Math.floor(r/3600);r-=s*3600;const o=Math.floor(r/60);return i>0?`resets in ${i}d ${s}h`:s>0?`resets in ${s}h ${o}m`:`resets in ${o}m`}function lh({label:e,value:t,sub:n,tone:r="accent",testid:i}){const s=fx(t);return u.jsxs("div",{className:"usage-gauge","data-testid":i,children:[u.jsxs("div",{className:"usage-gauge-head",children:[u.jsx("span",{className:"usage-gauge-label",children:e}),u.jsxs("span",{className:"usage-gauge-val",children:[s,"%"]})]}),u.jsx("div",{className:"usage-bar",children:u.jsx("span",{className:`usage-bar-fill tone-${r}`,style:{width:`${s}%`}})}),n?u.jsx("div",{className:"usage-gauge-sub",children:n}):null]})}function sI({live:e,token:t}){var b,_,v,g,S;const[n,r]=w.useState(e||null),[i,s]=w.useState(!1),[o,a]=w.useState(()=>Date.now()),l=w.useRef(!0),c=t?{Authorization:`Bearer ${t}`}:{};w.useEffect(()=>(l.current=!0,fetch("/api/usage/state",{headers:c}).then(k=>k.ok?k.json():null).then(k=>{l.current&&k&&r(x=>x?{...x,...k}:k)}).catch(()=>{}),()=>{l.current=!1}),[t]),w.useEffect(()=>{e&&r(e)},[e]),w.useEffect(()=>{const k=setInterval(()=>a(Date.now()),3e4);return()=>clearInterval(k)},[]);async function d(){s(!0);try{await fetch("/api/usage/ack",{method:"POST",headers:c});const k=await fetch("/api/usage/refresh",{method:"POST",headers:c}).then(x=>x.ok?x.json():null).catch(()=>null);l.current&&r(x=>({...x||{},...k||{},disclosed:!0}))}finally{l.current&&s(!1)}}if(n&&n.disclosed===!1)return u.jsxs("div",{className:"usage-block usage-disclose","data-testid":"usage-disclosure",children:[u.jsx("div",{className:"usage-disclose-mark",children:"📊"}),u.jsx("p",{className:"usage-disclose-title",children:"Show your Claude usage?"}),u.jsxs("p",{className:"usage-disclose-body",children:["To show your plan usage, your workspace reads your Claude login ",u.jsx("strong",{children:"locally"})," and asks Anthropic for your numbers. It never leaves this machine except to Anthropic."]}),u.jsx("button",{className:"usage-disclose-ok",onClick:d,disabled:i,"data-testid":"usage-disclose-ok",children:i?"One sec…":"OK, show my usage"})]});if(!n)return u.jsxs("div",{className:"usage-block","data-testid":"usage-loading",children:[u.jsx("div",{className:"usage-skeleton"}),u.jsx("div",{className:"usage-skeleton"}),u.jsx("div",{className:"usage-skeleton short"})]});const h=n.plan||null,f=n.context||null,m=n.status||"loading",p=!h||m==="unavailable",y=m==="stale";return u.jsxs("div",{className:`usage-block ${y?"is-stale":""}`,"data-testid":"usage-block",children:[y&&u.jsx("div",{className:"usage-stale-note","data-testid":"usage-stale",children:"couldn't refresh — showing last known"}),h?u.jsxs(u.Fragment,{children:[u.jsx(lh,{label:"Session",value:(b=h.five_hour)==null?void 0:b.utilization,sub:Ky((_=h.five_hour)==null?void 0:_.resets_at,o),tone:"accent",testid:"usage-session"}),u.jsx(lh,{label:"Weekly",value:(v=h.seven_day)==null?void 0:v.utilization,sub:Ky((g=h.seven_day)==null?void 0:g.resets_at,o),tone:"weekly",testid:"usage-weekly"}),(S=h.extra_usage)!=null&&S.is_enabled?u.jsxs("div",{className:"usage-extra","data-testid":"usage-extra",children:["extra usage · ",fx(h.extra_usage.utilization),"% of $",h.extra_usage.monthly_limit]}):null]}):u.jsxs("div",{className:"usage-unavailable","data-testid":"usage-unavailable",children:[u.jsx("span",{className:"usage-unavailable-title",children:"Plan usage unavailable"}),u.jsx("span",{className:"usage-unavailable-sub",children:m==="unavailable"?"Sign in to Claude (or a non-Claude model is active).":"Couldn’t reach Anthropic just now."})]}),f?u.jsx(lh,{label:"Working memory",value:f.pct,sub:`${Math.round((f.used||0)/1e3)}k / ${Math.round((f.window||0)/1e3)}k tokens`,tone:"memory",testid:"usage-context"}):null,u.jsxs("div",{className:"usage-foot",children:[u.jsx("span",{className:"usage-live-dot","data-status":m}),u.jsx("span",{children:m==="live"?"live":m})]})]})}function oI({token:e,onRun:t}){const[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,a]=w.useState(null),l=w.useRef(!0),c=e?{Authorization:`Bearer ${e}`}:{};w.useEffect(()=>(l.current=!0,fetch("/api/powers/state",{headers:c}).then(g=>g.ok?g.json():null).then(g=>{l.current&&g&&r(g)}).catch(()=>{}),()=>{l.current=!1}),[e]);function d(){const g=((n==null?void 0:n.skills)||[]).map(k=>k.name),S=((n==null?void 0:n.skills)||[]).filter(k=>k.hidden).map(k=>k.name);a({order:g,hidden:S}),s(!0)}async function h(){const g=o||{order:[],hidden:[]},S=await fetch("/api/powers/curation",{method:"POST",headers:{...c,"Content-Type":"application/json"},body:JSON.stringify(g)}).then(x=>x.ok?x.json():null).catch(()=>null),k=await fetch("/api/powers/state",{headers:c}).then(x=>x.ok?x.json():null).catch(()=>null);return l.current&&(k&&r(k),s(!1),a(null)),S}function f(g){a(S=>{const k=new Set(S.hidden);return k.has(g)?k.delete(g):k.add(g),{...S,hidden:[...k]}})}function m(g,S){a(k=>{const x=[...k.order],T=x.indexOf(g),L=T+S;return T<0||L<0||L>=x.length?k:([x[T],x[L]]=[x[L],x[T]],{...k,order:x})})}if(!n)return u.jsxs("div",{className:"powers-block","data-testid":"powers-loading",children:[u.jsx("div",{className:"powers-skel"}),u.jsx("div",{className:"powers-skel"})]});const p=n.skills||[],y=new Set(i&&o?o.hidden:p.filter(g=>g.hidden).map(g=>g.name)),b=new Map((i&&o?o.order:p.map(g=>g.name)).map((g,S)=>[g,S])),_=[...p].sort((g,S)=>(b.get(g.name)??99)-(b.get(S.name)??99)),v=_.filter(g=>!y.has(g.name));return u.jsxs("div",{className:"powers-block","data-testid":"powers-block",children:[u.jsxs("div",{className:"powers-head",children:[u.jsx("span",{className:"powers-title",children:"Powers"}),p.length>0&&u.jsx("button",{className:"powers-edit",onClick:i?h:d,"data-testid":i?"powers-save":"powers-edit-toggle",children:i?"Done":"Customize"})]}),p.length===0?u.jsxs("div",{className:"powers-empty","data-testid":"powers-empty",children:[u.jsx("div",{className:"powers-empty-mark",children:"🧰"}),u.jsx("p",{className:"powers-empty-title",children:"No powers yet"}),u.jsxs("p",{className:"powers-empty-sub",children:["Skills you add to ",u.jsx("code",{children:".claude/skills"})," — your own or a teammate's — show up here as one-tap actions."]})]}):i?u.jsx("div",{className:"powers-list","data-testid":"powers-edit-list",children:_.map(g=>{const S=y.has(g.name);return u.jsxs("div",{className:`powers-row edit ${S?"is-hidden":""}`,"data-testid":`powers-row-${g.name}`,children:[u.jsxs("span",{className:"powers-reorder",children:[u.jsx("button",{onClick:()=>m(g.name,-1),title:"Move up","data-testid":`powers-up-${g.name}`,children:"▲"}),u.jsx("button",{onClick:()=>m(g.name,1),title:"Move down","data-testid":`powers-down-${g.name}`,children:"▼"})]}),u.jsxs("span",{className:"powers-row-name",children:["/",g.name]}),u.jsx("button",{className:"powers-hide",onClick:()=>f(g.name),"data-testid":`powers-hide-${g.name}`,children:S?"Show":"Hide"})]},g.name)})}):u.jsx("div",{className:"powers-list","data-testid":"powers-run-list",children:v.length===0?u.jsx("p",{className:"powers-allhidden",children:"All powers hidden — tap Customize to bring some back."}):v.map(g=>u.jsxs("button",{className:"powers-run",onClick:()=>t==null?void 0:t(g.name),title:g.description||`Run /${g.name}`,"data-testid":`powers-run-${g.name}`,children:[u.jsxs("span",{className:"powers-run-name",children:["/",g.name]}),g.description?u.jsx("span",{className:"powers-run-desc",children:g.description}):null,g.source==="user"?u.jsx("span",{className:"powers-tag",children:"yours"}):null]},g.name))}),u.jsxs("div",{className:"powers-bazaar","data-testid":"powers-bazaar-locked",children:[u.jsx("div",{className:"powers-divider",children:"─ from Bazaar ─"}),u.jsx("p",{className:"powers-bazaar-note",children:"🔒 Verified marketplace skills land here — coming soon."})]})]})}function Yy(e){return`$${(Number(e)||0).toFixed(2)}`}function aI({live:e,token:t}){const[n,r]=w.useState(e||null);w.useEffect(()=>{let c=!1;const d=t?{Authorization:`Bearer ${t}`}:{};return fetch("/api/bazaar/state",{headers:d}).then(h=>h.ok?h.json():null).then(h=>{!c&&h&&r(f=>f||h)}).catch(()=>{}),()=>{c=!0}},[t]),w.useEffect(()=>{e&&r(e)},[e]);const i=(n==null?void 0:n.earnings)||[],s=(n==null?void 0:n.totals)||{creditPaid:0},o=i.reduce((c,d)=>c+(d.matches||0),0),a=i.reduce((c,d)=>c+(d.uses||0),0),l=Math.max(1,...i.map(c=>c.total||0));return i.length?u.jsxs("div",{className:"analytics-block","data-testid":"analytics-block",children:[u.jsxs("div",{className:"an-stats",children:[u.jsxs("div",{className:"an-stat",children:[u.jsx("span",{className:"an-stat-num",children:Yy(s.creditPaid)}),u.jsx("span",{className:"an-stat-lbl",children:"represented"})]}),u.jsxs("div",{className:"an-stat",children:[u.jsx("span",{className:"an-stat-num",children:o||a}),u.jsx("span",{className:"an-stat-lbl",children:o?"matches":"builds"})]}),u.jsxs("div",{className:"an-stat",children:[u.jsx("span",{className:"an-stat-num",children:i.length}),u.jsx("span",{className:"an-stat-lbl",children:i.length===1?"producer":"producers"})]})]}),u.jsx("div",{className:"an-board",children:i.slice(0,6).map(c=>u.jsxs("div",{className:"an-row","data-testid":`analytics-row-${c.handle}`,children:[u.jsxs("span",{className:"an-row-name",children:[c.name,c.handle==="you"&&u.jsx("span",{className:"earn-you-tag",children:"you"})]}),u.jsx("span",{className:"an-row-bar",children:u.jsx("span",{className:"an-row-fill",style:{width:`${Math.round((c.total||0)/l*100)}%`}})}),u.jsx("span",{className:"an-row-val",children:Yy(c.total)})]},c.handle))}),u.jsx("div",{className:"an-foot",children:"represented · settles later"})]}):u.jsxs("div",{className:"earn-empty","data-testid":"analytics-empty",children:[u.jsx("div",{className:"earn-empty-mark",children:"📊"}),u.jsx("p",{className:"earn-empty-title",children:"No activity yet"}),u.jsx("p",{className:"earn-empty-sub",children:"Once builds and matches start flowing across the shelf, you'll see who's earning and how much, here."})]})}function lI({token:e,selectedFile:t,onOpenFile:n}){const[r,i]=w.useState(null),[s,o]=w.useState(null),[a,l]=w.useState(()=>new Set);w.useEffect(()=>{let h=!1;const f=e?{Authorization:`Bearer ${e}`}:{};return fetch("/api/workspace/tree",{headers:f}).then(m=>m.json()).then(m=>{h||(m.error?o(m.error):i(m.entries||[]))}).catch(m=>!h&&o(m.message||String(m))),()=>{h=!0}},[e]);function c(h){l(f=>{const m=new Set(f);return m.has(h)?m.delete(h):m.add(h),m})}function d(h,f=0){var b;const m=h.type==="dir",p=a.has(h.path),y=!m&&h.path===t;return u.jsxs("div",{children:[u.jsxs("div",{className:`fnode ${m?"dir":""} ${y?"sel":""}`,onClick:()=>m?c(h.path):n==null?void 0:n(h.path),style:{paddingLeft:f*12+6},"data-testid":`files-node-${h.path}`,title:h.path,children:[u.jsx("span",{className:"fnode-tw",children:m?p?"▾":"▸":""}),u.jsx("span",{className:"fnode-ic",children:m?"📁":"📄"}),u.jsx("span",{className:"fnode-nm",children:h.name})]}),m&&p&&((b=h.children)==null?void 0:b.map(_=>d(_,f+1)))]},h.path)}return u.jsxs("div",{className:"files-block","data-testid":"files-block",children:[s&&u.jsx("div",{className:"files-msg err",children:s==="forbidden"?"Files aren't available on this view.":s}),!r&&!s&&u.jsxs("div",{className:"files-msg",children:[u.jsx("span",{className:"spinner"})," loading…"]}),(r==null?void 0:r.length)===0&&u.jsx("div",{className:"files-msg",children:"Empty workspace"}),r==null?void 0:r.map(h=>d(h,0))]})}const cI={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",markdown:"markdown",css:"css",scss:"scss",html:"markup",xml:"markup",svg:"markup",py:"python",rs:"rust",go:"go",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",toml:"toml",sql:"sql",java:"java",c:"c",h:"c",cpp:"cpp",rb:"ruby",php:"php"};function uI(e){const t=String(e||"").split(".").pop().toLowerCase();return cI[t]||"text"}function hI({path:e,token:t,onPickFile:n}){const[r,i]=w.useState(e||""),[s,o]=w.useState({loading:!1});w.useEffect(()=>{i(e||"")},[e]),w.useEffect(()=>{if(!e){o({loading:!1});return}let l=!1;o({loading:!0});const c=t?{Authorization:`Bearer ${t}`}:{};return fetch(`/api/workspace/file?path=${encodeURIComponent(e)}`,{headers:c}).then(d=>d.json()).then(d=>{l||o({loading:!1,...d})}).catch(d=>{l||o({loading:!1,error:d.message||String(d)})}),()=>{l=!0}},[e,t]);const a=uI(e);return u.jsxs("div",{className:"codeblock","data-testid":"code-view-block",children:[u.jsxs("div",{className:"codeblock-bar",children:[u.jsx("input",{className:"codeblock-path",value:r,onChange:l=>i(l.target.value),onKeyDown:l=>l.key==="Enter"&&(n==null?void 0:n(r.trim())),placeholder:"path/to/file",spellCheck:!1,"data-testid":"code-path"}),s.truncated&&u.jsx("span",{className:"codeblock-trunc",title:"Large file — showing the start",children:"truncated"})]}),u.jsxs("div",{className:"codeblock-body",children:[!e&&u.jsx("div",{className:"codeblock-msg",children:"Pick a file in the Files block — or type a path above — to view it here."}),e&&s.loading&&u.jsxs("div",{className:"codeblock-msg",children:[u.jsx("span",{className:"spinner"})," loading…"]}),e&&s.error&&u.jsx("div",{className:"codeblock-msg err",children:s.error==="forbidden"?"Files aren't available on this view.":s.error}),e&&!s.loading&&!s.error&&typeof s.content=="string"&&u.jsx(NS,{theme:Ip.vsDark,code:s.content,language:a,children:({tokens:l,getLineProps:c,getTokenProps:d})=>u.jsx("pre",{className:"codeblock-pre",children:l.map((h,f)=>u.jsxs("div",{...c({line:h}),className:"codeblock-line",children:[u.jsx("span",{className:"codeblock-ln",children:f+1}),u.jsx("span",{className:"codeblock-lc",children:h.map((m,p)=>u.jsx("span",{...d({token:m})},p))})]},f))})})]})]})}function dI({id:e}){const t=`wild:todo:${e}`,[n,r]=w.useState(()=>{try{const d=JSON.parse(localStorage.getItem(t)||"[]");return Array.isArray(d)?d:[]}catch{return[]}}),[i,s]=w.useState("");w.useEffect(()=>{try{localStorage.setItem(t,JSON.stringify(n))}catch{}},[t,n]);function o(){const d=i.trim();d&&(r(h=>[...h,{id:`${Date.now().toString(36)}-${h.length}`,text:d,done:!1}]),s(""))}function a(d){r(h=>h.map(f=>f.id===d?{...f,done:!f.done}:f))}function l(d){r(h=>h.filter(f=>f.id!==d))}const c=n.filter(d=>!d.done).length;return u.jsxs("div",{className:"todo-block","data-testid":"todo-block",children:[u.jsxs("div",{className:"todo-add",children:[u.jsx("input",{value:i,onChange:d=>s(d.target.value),onKeyDown:d=>d.key==="Enter"&&o(),placeholder:"Add a to-do…","data-testid":"todo-input"}),u.jsx("button",{onClick:o,disabled:!i.trim(),"data-testid":"todo-add-btn",children:"Add"})]}),u.jsxs("div",{className:"todo-list",children:[n.length===0&&u.jsx("div",{className:"todo-msg",children:"Nothing yet — add your first to-do above."}),n.map(d=>u.jsxs("div",{className:`todo-item ${d.done?"done":""}`,"data-testid":"todo-item",children:[u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:d.done,onChange:()=>a(d.id)}),u.jsx("span",{className:"todo-text",children:d.text})]}),u.jsx("button",{className:"todo-del",title:"Remove",onClick:()=>l(d.id),children:"✕"})]},d.id))]}),n.length>0&&u.jsxs("div",{className:"todo-foot",children:[c," left · ",n.length-c," done"]})]})}const fI=4e3,pI="server";function mI({token:e}){const[t,n]=w.useState(null),[r,i]=w.useState(null),[s,o]=w.useState(null),[a,l]=w.useState(null),c=w.useRef(null);return w.useEffect(()=>{let d=!1;const h=e?{Authorization:`Bearer ${e}`}:{};return fetch("/api/workspace/logs",{headers:h}).then(f=>f.json()).then(f=>{if(d)return;if(f.error){l(f.error);return}const m=f.logs||[];n(m);const p=m.filter(b=>b.exists),y=p.find(b=>b.name===pI)||p[0]||m[0];y&&i(y.name)}).catch(f=>!d&&l(f.message||String(f))),()=>{d=!0}},[e]),w.useEffect(()=>{if(!r)return;let d=!1;const h=e?{Authorization:`Bearer ${e}`}:{},f=()=>{typeof document<"u"&&document.hidden||fetch(`/api/workspace/logs?name=${encodeURIComponent(r)}&lines=300`,{headers:h}).then(p=>p.json()).then(p=>{d||(p.error?l(p.error):(l(null),o(p.body||"")))}).catch(p=>!d&&l(p.message||String(p)))};o(null),f();const m=setInterval(f,fI);return()=>{d=!0,clearInterval(m)}},[r,e]),w.useEffect(()=>{const d=c.current;d&&(d.scrollTop=d.scrollHeight)},[s]),a?u.jsx("div",{className:"logs-block","data-testid":"logs-block",children:u.jsx("div",{className:"logs-msg err",children:a==="forbidden"?"Logs aren't available on this view.":String(a)})}):u.jsxs("div",{className:"logs-block","data-testid":"logs-block",children:[t&&u.jsxs("div",{className:"logs-bar",children:[u.jsx("select",{className:"logs-select","data-testid":"logs-select",value:r||"",onChange:d=>i(d.target.value),children:t.map(d=>u.jsxs("option",{value:d.name,children:[d.name,d.exists?"":" · empty"]},d.name))}),u.jsx("span",{className:"logs-hint",children:"live · auto-refresh"})]}),u.jsxs("div",{className:"logs-body",children:[s===null&&u.jsxs("div",{className:"logs-msg",children:[u.jsx("span",{className:"spinner"})," loading…"]}),s===""&&u.jsx("div",{className:"logs-msg",children:"No log output yet."}),s&&u.jsx("pre",{className:"logs-out","data-testid":"logs-out",ref:c,children:s})]})]})}const cl=100;function gI(e){const t=[];let n=[],r="",i=!1;for(let s=0;s<e.length;s+=1){const o=e[s];i?o==='"'?e[s+1]==='"'?(r+='"',s+=1):i=!1:r+=o:o==='"'?i=!0:o===","?(n.push(r),r=""):o===`
|
|
92
|
+
`?(n.push(r),r="",t.push(n),n=[]):o!=="\r"&&(r+=o)}return(r!==""||n.length>0)&&(n.push(r),t.push(n)),t.filter(s=>!(s.length===1&&s[0]===""))}function yI(e,t){const n=e.trim();if(t.endsWith(".json")||!t.endsWith(".csv")&&!t.endsWith(".tsv")&&/^[[{]/.test(n)){let a;try{a=JSON.parse(n)}catch(h){throw new Error(`Invalid JSON: ${h.message}`)}let l=Array.isArray(a)?a:[a];if(l.every(h=>h===null||typeof h!="object"))return{columns:["value"],rows:l.map(h=>({value:h}))};const d=[];for(const h of l)if(h&&typeof h=="object"&&!Array.isArray(h))for(const f of Object.keys(h))d.includes(f)||d.push(f);return d.length===0&&d.push("value"),l=l.map(h=>h&&typeof h=="object"&&!Array.isArray(h)?h:{value:h}),{columns:d,rows:l}}const i=gI(e);if(i.length===0)return{columns:[],rows:[]};const s=i[0].map((a,l)=>a||`col${l+1}`),o=i.slice(1).map(a=>{const l={};return s.forEach((c,d)=>{l[c]=a[d]??""}),l});return{columns:s,rows:o}}function ul(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function _I({token:e}){const[t,n]=w.useState(""),[r,i]=w.useState(""),[s,o]=w.useState(null),[a,l]=w.useState(null),[c,d]=w.useState(!1),[h,f]=w.useState(""),[m,p]=w.useState(null);function y(v){const g=r.trim();if(!g)return;n(g),d(!0),l(null),o(null),f(""),p(null);const S=e?{Authorization:`Bearer ${e}`}:{};fetch(`/api/workspace/file?path=${encodeURIComponent(g)}`,{headers:S}).then(k=>k.json()).then(k=>{if(k.error){l(k.error==="forbidden"?"Data files aren't available on this view.":k.error);return}try{o(yI(k.content||"",g))}catch(x){l(x.message||String(x))}}).catch(k=>l(k.message||String(k))).finally(()=>d(!1))}function b(v){p(g=>!g||g.col!==v?{col:v,dir:"asc"}:g.dir==="asc"?{col:v,dir:"desc"}:null)}const _=w.useMemo(()=>{if(!s)return null;let v=s.rows;const g=h.trim().toLowerCase();if(g&&(v=v.filter(S=>s.columns.some(k=>ul(S[k]).toLowerCase().includes(g)))),m){const{col:S,dir:k}=m;v=[...v].sort((x,T)=>{const L=x[S],B=T[S],j=Number(L),F=Number(B);let A;return L!==""&&B!==""&&!Number.isNaN(j)&&!Number.isNaN(F)?A=j-F:A=ul(L).localeCompare(ul(B)),k==="asc"?A:-A})}return{total:v.length,rows:v.slice(0,cl)}},[s,h,m]);return u.jsxs("div",{className:"dtable-block","data-testid":"datatable-block",children:[u.jsxs("div",{className:"dtable-bar",children:[u.jsx("input",{className:"dtable-path","data-testid":"datatable-path",value:r,onChange:v=>i(v.target.value),onKeyDown:v=>{v.key==="Enter"&&y()},placeholder:"data.csv or records.json","aria-label":"File path"}),u.jsx("button",{className:"dtable-load","data-testid":"datatable-load",onClick:()=>y(),disabled:!r.trim()||c,children:c?"…":"Load"}),s&&u.jsx("input",{className:"dtable-filter","data-testid":"datatable-filter",value:h,onChange:v=>f(v.target.value),placeholder:"Filter rows…","aria-label":"Filter rows"})]}),u.jsxs("div",{className:"dtable-body",children:[a&&u.jsx("div",{className:"dtable-msg err","data-testid":"datatable-error",children:a}),c&&u.jsxs("div",{className:"dtable-msg",children:[u.jsx("span",{className:"spinner"})," loading ",t,"…"]}),!c&&!a&&!s&&u.jsx("div",{className:"dtable-msg","data-testid":"datatable-empty",children:"Enter a CSV or JSON file path from your workspace to load it as a table."}),!c&&!a&&s&&s.columns.length===0&&u.jsx("div",{className:"dtable-msg",children:"That file has no rows to show."}),!c&&!a&&_&&s.columns.length>0&&u.jsxs(u.Fragment,{children:[_.total===0?u.jsxs("div",{className:"dtable-msg","data-testid":"datatable-nomatch",children:["No rows match “",h,"”."]}):u.jsx("div",{className:"dtable-scroll",children:u.jsxs("table",{className:"dtable","data-testid":"datatable",children:[u.jsx("thead",{children:u.jsx("tr",{children:s.columns.map(v=>u.jsxs("th",{onClick:()=>b(v),"data-testid":`datatable-th-${v}`,title:"Click to sort",children:[v,(m==null?void 0:m.col)===v?m.dir==="asc"?" ▲":" ▼":""]},v))})}),u.jsx("tbody",{children:_.rows.map((v,g)=>u.jsx("tr",{children:s.columns.map(S=>u.jsx("td",{children:ul(v[S])},S))},g))})]})}),_.total>0&&u.jsxs("div",{className:"dtable-foot",children:["showing ",Math.min(_.total,cl)," of ",_.total," row",_.total===1?"":"s",_.total>cl?` (capped at ${cl})`:""]})]})]})]})}function vI({canDeploy:e,onSetup:t}){return u.jsxs("div",{className:"deploy-block","data-testid":"deploy-block",children:[u.jsxs("div",{className:"deploy-empty",children:[u.jsx("div",{className:"deploy-icon",children:"🚀"}),u.jsx("p",{className:"deploy-title",children:"No deploy target connected yet"}),u.jsx("p",{className:"deploy-sub",children:"When you’re ready to put this build online, your agent handles the deploy — wiring up a target, building, and shipping it. Nothing here is faked."}),e?u.jsx("button",{className:"deploy-btn primary","data-testid":"deploy-setup",onClick:()=>t==null?void 0:t(),children:"Set up deployment"}):u.jsx("p",{className:"deploy-note","data-testid":"deploy-locked",children:"Ask the workspace owner to set up a deploy target."})]}),u.jsxs("div",{className:"deploy-history",children:[u.jsx("div",{className:"deploy-history-h",children:"Recent deploys"}),u.jsx("div",{className:"deploy-msg","data-testid":"deploy-history-empty",children:"No deployments yet."})]})]})}/**
|
|
93
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
94
|
+
* @license MIT
|
|
95
|
+
*
|
|
96
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
97
|
+
* @license MIT
|
|
98
|
+
*
|
|
99
|
+
* Originally forked from (with the author's permission):
|
|
100
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
101
|
+
* http://bellard.org/jslinux/
|
|
102
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
103
|
+
*/var px=Object.defineProperty,bI=Object.getOwnPropertyDescriptor,wI=(e,t)=>{for(var n in t)px(e,n,{get:t[n],enumerable:!0})},Rt=(e,t,n,r)=>{for(var i=r>1?void 0:r?bI(t,n):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&px(t,n,i),i},fe=(e,t)=>(n,r)=>t(n,r,e),Gy="Terminal input",Od={get:()=>Gy,set:e=>Gy=e},Xy="Too much output to announce, navigate to rows manually to read",zd={get:()=>Xy,set:e=>Xy=e};function SI(e){return e.replace(/\r?\n/g,"\r")}function xI(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function kI(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function CI(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");mx(i,t,n,r)}}function mx(e,t,n,r){e=SI(e),e=xI(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function gx(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function Jy(e,t,n,r,i){gx(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ci(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ou(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var EI=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return this._interim=o,r;let a=e.charCodeAt(s);56320<=a&&a<=57343?t[r++]=(o-55296)*1024+a-56320+65536:(t[r++]=o,t[r++]=a);continue}o!==65279&&(t[r++]=o)}return r}},NI=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,s,o,a,l=0,c=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,y;for(;(y=this.interim[++p]&63)&&p<4;)m<<=6,m|=y;let b=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,_=b-p;for(;c<_;){if(c>=n)return 0;if(y=e[c++],(y&192)!==128){c--,f=!0;break}else this.interim[p++]=y,m<<=6,m|=y&63}f||(b===2?m<128?c--:t[r++]=m:b===3?m<2048||m>=55296&&m<=57343||m===65279||(t[r++]=m):m<65536||m>1114111||(t[r++]=m)),this.interim.fill(0)}let d=n-4,h=c;for(;h<n;){for(;h<d&&!((i=e[h])&128)&&!((s=e[h+1])&128)&&!((o=e[h+2])&128)&&!((a=e[h+3])&128);)t[r++]=i,t[r++]=s,t[r++]=o,t[r++]=a,h+=4;if(i=e[h++],i<128)t[r++]=i;else if((i&224)===192){if(h>=n)return this.interim[0]=i,r;if(s=e[h++],(s&192)!==128){h--;continue}if(l=(i&31)<<6|s&63,l<128){h--;continue}t[r++]=l}else if((i&240)===224){if(h>=n)return this.interim[0]=i,r;if(s=e[h++],(s&192)!==128){h--;continue}if(h>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[h++],(o&192)!==128){h--;continue}if(l=(i&15)<<12|(s&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[r++]=l}else if((i&248)===240){if(h>=n)return this.interim[0]=i,r;if(s=e[h++],(s&192)!==128){h--;continue}if(h>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[h++],(o&192)!==128){h--;continue}if(h>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,r;if(a=e[h++],(a&192)!==128){h--;continue}if(l=(i&7)<<18|(s&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[r++]=l}}return r}},yx="",pi=" ",Da=class _x{constructor(){this.fg=0,this.bg=0,this.extended=new wc}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new _x;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},wc=class vx{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new vx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},nr=class bx extends Da{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wc,this.combinedData=""}static fromCharData(t){let n=new bx;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ci(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Zy="di$target",Bd="di$dependencies",ch=new Map;function jI(e){return e[Bd]||[]}function en(e){if(ch.has(e))return ch.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");RI(t,n,i)};return t._id=e,ch.set(e,t),t}function RI(e,t,n){t[Zy]===t?t[Bd].push({id:e,index:n}):(t[Bd]=[{id:e,index:n}],t[Zy]=t)}var xn=en("BufferService"),wx=en("CoreMouseService"),fs=en("CoreService"),TI=en("CharsetService"),Qp=en("InstantiationService"),Sx=en("LogService"),kn=en("OptionsService"),xx=en("OscLinkService"),DI=en("UnicodeService"),Pa=en("DecorationService"),Fd=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var d;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new nr,o=n.getTrimmedLength(),a=-1,l=-1,c=!1;for(let h=0;h<o;h++)if(!(l===-1&&!n.hasContent(h))){if(n.loadCell(h,s),s.hasExtendedAttrs()&&s.extended.urlId)if(l===-1){l=h,a=s.extended.urlId;continue}else c=s.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&h===o-1){let f=(d=this._oscLinkService.getLinkData(a))==null?void 0:d.uri;if(f){let m={start:{x:l+1,y:e},end:{x:h+(!c&&h===o-1?1:0),y:e}},p=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let y=new URL(f);["http:","https:"].includes(y.protocol)||(p=!0)}catch{p=!0}p||r.push({text:f,range:m,activate:(y,b)=>i?i.activate(y,b,m):PI(y,b),hover:(y,b)=>{var _;return(_=i==null?void 0:i.hover)==null?void 0:_.call(i,y,b,m)},leave:(y,b)=>{var _;return(_=i==null?void 0:i.leave)==null?void 0:_.call(i,y,b,m)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(l=h,a=s.extended.urlId):(l=-1,a=-1)}}t(r)}};Fd=Rt([fe(0,xn),fe(1,kn),fe(2,xx)],Fd);function PI(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
104
|
+
|
|
105
|
+
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var au=en("CharSizeService"),Xr=en("CoreBrowserService"),em=en("MouseService"),Jr=en("RenderService"),LI=en("SelectionService"),kx=en("CharacterJoinerService"),lo=en("ThemeService"),Cx=en("LinkProviderService"),AI=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Qy.isErrorNoTelemetry(e)?new Qy(e.message+`
|
|
106
|
+
|
|
107
|
+
`+e.stack):new Error(e.message+`
|
|
108
|
+
|
|
109
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},II=new AI;function Il(e){MI(e)||II.onUnexpectedError(e)}var $d="Canceled";function MI(e){return e instanceof OI?!0:e instanceof Error&&e.name===$d&&e.message===$d}var OI=class extends Error{constructor(){super($d),this.name=this.message}};function zI(e){return new Error(`Illegal argument: ${e}`)}var Qy=class Hd extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Hd)return t;let n=new Hd;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Wd=class Ex extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Ex.prototype)}};function Mn(e,t=0){return e[e.length-(1+t)]}var BI;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(BI||(BI={}));function FI(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var Nx;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(S){yield S}e.single=i;function s(S){return t(S)?S:i(S)}e.wrap=s;function o(S){return S||n}e.from=o;function*a(S){for(let k=S.length-1;k>=0;k--)yield S[k]}e.reverse=a;function l(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=l;function c(S){return S[Symbol.iterator]().next().value}e.first=c;function d(S,k){let x=0;for(let T of S)if(k(T,x++))return!0;return!1}e.some=d;function h(S,k){for(let x of S)if(k(x))return x}e.find=h;function*f(S,k){for(let x of S)k(x)&&(yield x)}e.filter=f;function*m(S,k){let x=0;for(let T of S)yield k(T,x++)}e.map=m;function*p(S,k){let x=0;for(let T of S)yield*k(T,x++)}e.flatMap=p;function*y(...S){for(let k of S)yield*k}e.concat=y;function b(S,k,x){let T=x;for(let L of S)T=k(T,L);return T}e.reduce=b;function*_(S,k,x=S.length){for(k<0&&(k+=S.length),x<0?x+=S.length:x>S.length&&(x=S.length);k<x;k++)yield S[k]}e.slice=_;function v(S,k=Number.POSITIVE_INFINITY){let x=[];if(k===0)return[x,S];let T=S[Symbol.iterator]();for(let L=0;L<k;L++){let B=T.next();if(B.done)return[x,e.empty()];x.push(B.value)}return[x,{[Symbol.iterator](){return T}}]}e.consume=v;async function g(S){let k=[];for await(let x of S)k.push(x);return Promise.resolve(k)}e.asyncToArray=g})(Nx||(Nx={}));function ls(e){if(Nx.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function $I(...e){return pt(()=>ls(e))}function pt(e){return{dispose:FI(()=>{e()})}}var jx=class Rx{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ls(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Rx.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};jx.DISABLE_DISPOSED_WARNING=!1;var xi=jx,ze=class{constructor(){this._store=new xi,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ze.None=Object.freeze({dispose(){}});var to=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},$r=typeof window=="object"?window:globalThis,Ud=class Vd{constructor(t){this.element=t,this.next=Vd.Undefined,this.prev=Vd.Undefined}};Ud.Undefined=new Ud(void 0);var yt=Ud,e_=class{constructor(){this._first=yt.Undefined,this._last=yt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===yt.Undefined}clear(){let e=this._first;for(;e!==yt.Undefined;){let t=e.next;e.prev=yt.Undefined,e.next=yt.Undefined,e=t}this._first=yt.Undefined,this._last=yt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new yt(e);if(this._first===yt.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==yt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==yt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==yt.Undefined&&e.next!==yt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===yt.Undefined&&e.next===yt.Undefined?(this._first=yt.Undefined,this._last=yt.Undefined):e.next===yt.Undefined?(this._last=this._last.prev,this._last.next=yt.Undefined):e.prev===yt.Undefined&&(this._first=this._first.next,this._first.prev=yt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==yt.Undefined;)yield e.element,e=e.next}},HI=globalThis.performance&&typeof globalThis.performance.now=="function",WI=class Tx{static create(t){return new Tx(t)}constructor(t){this._now=HI&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},sn;(e=>{e.None=()=>ze.None;function t(A,R){return h(A,()=>{},0,void 0,!0,void 0,R)}e.defer=t;function n(A){return(R,P=null,N)=>{let O=!1,W;return W=A(D=>{if(!O)return W?W.dispose():O=!0,R.call(P,D)},null,N),O&&W.dispose(),W}}e.once=n;function r(A,R,P){return c((N,O=null,W)=>A(D=>N.call(O,R(D)),null,W),P)}e.map=r;function i(A,R,P){return c((N,O=null,W)=>A(D=>{R(D),N.call(O,D)},null,W),P)}e.forEach=i;function s(A,R,P){return c((N,O=null,W)=>A(D=>R(D)&&N.call(O,D),null,W),P)}e.filter=s;function o(A){return A}e.signal=o;function a(...A){return(R,P=null,N)=>{let O=$I(...A.map(W=>W(D=>R.call(P,D))));return d(O,N)}}e.any=a;function l(A,R,P,N){let O=P;return r(A,W=>(O=R(O,W),O),N)}e.reduce=l;function c(A,R){let P,N={onWillAddFirstListener(){P=A(O.fire,O)},onDidRemoveLastListener(){P==null||P.dispose()}},O=new te(N);return R==null||R.add(O),O.event}function d(A,R){return R instanceof Array?R.push(A):R&&R.add(A),A}function h(A,R,P=100,N=!1,O=!1,W,D){let I,C,X,ie=0,E,ue={leakWarningThreshold:W,onWillAddFirstListener(){I=A(Z=>{ie++,C=R(C,Z),N&&!X&&(ve.fire(C),C=void 0),E=()=>{let pe=C;C=void 0,X=void 0,(!N||ie>1)&&ve.fire(pe),ie=0},typeof P=="number"?(clearTimeout(X),X=setTimeout(E,P)):X===void 0&&(X=0,queueMicrotask(E))})},onWillRemoveListener(){O&&ie>0&&(E==null||E())},onDidRemoveLastListener(){E=void 0,I.dispose()}},ve=new te(ue);return D==null||D.add(ve),ve.event}e.debounce=h;function f(A,R=0,P){return e.debounce(A,(N,O)=>N?(N.push(O),N):[O],R,void 0,!0,void 0,P)}e.accumulate=f;function m(A,R=(N,O)=>N===O,P){let N=!0,O;return s(A,W=>{let D=N||!R(W,O);return N=!1,O=W,D},P)}e.latch=m;function p(A,R,P){return[e.filter(A,R,P),e.filter(A,N=>!R(N),P)]}e.split=p;function y(A,R=!1,P=[],N){let O=P.slice(),W=A(C=>{O?O.push(C):I.fire(C)});N&&N.add(W);let D=()=>{O==null||O.forEach(C=>I.fire(C)),O=null},I=new te({onWillAddFirstListener(){W||(W=A(C=>I.fire(C)),N&&N.add(W))},onDidAddFirstListener(){O&&(R?setTimeout(D):D())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return N&&N.add(I),I.event}e.buffer=y;function b(A,R){return(P,N,O)=>{let W=R(new v);return A(function(D){let I=W.evaluate(D);I!==_&&P.call(N,I)},void 0,O)}}e.chain=b;let _=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(R){return this.steps.push(R),this}forEach(R){return this.steps.push(P=>(R(P),P)),this}filter(R){return this.steps.push(P=>R(P)?P:_),this}reduce(R,P){let N=P;return this.steps.push(O=>(N=R(N,O),N)),this}latch(R=(P,N)=>P===N){let P=!0,N;return this.steps.push(O=>{let W=P||!R(O,N);return P=!1,N=O,W?O:_}),this}evaluate(R){for(let P of this.steps)if(R=P(R),R===_)break;return R}}function g(A,R,P=N=>N){let N=(...I)=>D.fire(P(...I)),O=()=>A.on(R,N),W=()=>A.removeListener(R,N),D=new te({onWillAddFirstListener:O,onDidRemoveLastListener:W});return D.event}e.fromNodeEventEmitter=g;function S(A,R,P=N=>N){let N=(...I)=>D.fire(P(...I)),O=()=>A.addEventListener(R,N),W=()=>A.removeEventListener(R,N),D=new te({onWillAddFirstListener:O,onDidRemoveLastListener:W});return D.event}e.fromDOMEventEmitter=S;function k(A){return new Promise(R=>n(A)(R))}e.toPromise=k;function x(A){let R=new te;return A.then(P=>{R.fire(P)},()=>{R.fire(void 0)}).finally(()=>{R.dispose()}),R.event}e.fromPromise=x;function T(A,R){return A(P=>R.fire(P))}e.forward=T;function L(A,R,P){return R(P),A(N=>R(N))}e.runAndSubscribe=L;class B{constructor(R,P){this._observable=R,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{R.addObserver(this)},onDidRemoveLastListener:()=>{R.removeObserver(this)}};this.emitter=new te(N),P&&P.add(this.emitter)}beginUpdate(R){this._counter++}handlePossibleChange(R){}handleChange(R,P){this._hasChanged=!0}endUpdate(R){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function j(A,R){return new B(A,R).emitter.event}e.fromObservable=j;function F(A){return(R,P,N)=>{let O=0,W=!1,D={beginUpdate(){O++},endUpdate(){O--,O===0&&(A.reportChanges(),W&&(W=!1,R.call(P)))},handlePossibleChange(){},handleChange(){W=!0}};A.addObserver(D),A.reportChanges();let I={dispose(){A.removeObserver(D)}};return N instanceof xi?N.add(I):Array.isArray(N)&&N.push(I),I}}e.fromObservableLight=F})(sn||(sn={}));var qd=class Kd{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Kd._idPool++}`,Kd.all.add(this)}start(t){this._stopWatch=new WI,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};qd.all=new Set,qd._idPool=0;var UI=qd,VI=-1,Dx=class Px{constructor(t,n,r=(Px._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let l=new YI(a,s);this._errorHandler(l)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};Dx._idPool=1;var qI=Dx,KI=class Lx{constructor(t){this.value=t}static create(){let t=new Error;return new Lx(t.stack??"")}print(){console.warn(this.value.split(`
|
|
110
|
+
`).slice(2).join(`
|
|
111
|
+
`))}},YI=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},GI=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},XI=0,uh=class{constructor(e){this.value=e,this.id=XI++}},JI=2,ZI,te=class{constructor(e){var t,n,r,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new qI((e==null?void 0:e.onListenerError)??Il,((n=this._options)==null?void 0:n.leakWarningThreshold)??VI):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new UI(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,a,l,c,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new GI(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Il)(m),ze.None}if(this._disposed)return ze.None;t&&(e=e.bind(t));let r=new uh(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=KI.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof uh?(this._deliveryQueue??(this._deliveryQueue=new QI),this._listeners=[this._listeners,r]):this._listeners.push(r):((l=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||l.call(a,this),this._listeners=r,(d=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||d.call(c,this)),this._size++;let s=pt(()=>{i==null||i(),this._removeListener(r)});return n instanceof xi?n.add(s):Array.isArray(n)&&n.push(s),s}),this._event}_removeListener(e){var i,s,o,a;if((s=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||s.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*JI<=t.length){let l=0;for(let c=0;c<t.length;c++)t[c]?t[l++]=t[c]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||Il;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,i;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof uh)this._deliver(this._listeners,e);else{let s=this._deliveryQueue;s.enqueue(this,e,this._listeners.length),this._deliverQueue(s)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},QI=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Yd=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new te,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Yd.INSTANCE=new Yd;var tm=Yd;function eM(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}tm.INSTANCE.onDidChangeZoomLevel;function tM(e){return tm.INSTANCE.getZoomFactor(e)}tm.INSTANCE.onDidChangeFullscreen;var co=typeof navigator=="object"?navigator.userAgent:"",Gd=co.indexOf("Firefox")>=0,nM=co.indexOf("AppleWebKit")>=0,nm=co.indexOf("Chrome")>=0,rM=!nm&&co.indexOf("Safari")>=0;co.indexOf("Electron/")>=0;co.indexOf("Android")>=0;var hh=!1;if(typeof $r.matchMedia=="function"){let e=$r.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=$r.matchMedia("(display-mode: fullscreen)");hh=e.matches,eM($r,e,({matches:n})=>{hh&&t.matches||(hh=n)})}var Os="en",Xd=!1,Jd=!1,Ml=!1,Ax=!1,hl,Ol=Os,t_=Os,iM,lr,Qi=globalThis,rn,ev;typeof Qi.vscode<"u"&&typeof Qi.vscode.process<"u"?rn=Qi.vscode.process:typeof process<"u"&&typeof((ev=process==null?void 0:process.versions)==null?void 0:ev.node)=="string"&&(rn=process);var tv,sM=typeof((tv=rn==null?void 0:rn.versions)==null?void 0:tv.electron)=="string",oM=sM&&(rn==null?void 0:rn.type)==="renderer",nv;if(typeof rn=="object"){Xd=rn.platform==="win32",Jd=rn.platform==="darwin",Ml=rn.platform==="linux",Ml&&rn.env.SNAP&&rn.env.SNAP_REVISION,rn.env.CI||rn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hl=Os,Ol=Os;let e=rn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);hl=t.userLocale,t_=t.osLocale,Ol=t.resolvedLanguage||Os,iM=(nv=t.languagePack)==null?void 0:nv.translationsConfigFile}catch{}Ax=!0}else typeof navigator=="object"&&!oM?(lr=navigator.userAgent,Xd=lr.indexOf("Windows")>=0,Jd=lr.indexOf("Macintosh")>=0,(lr.indexOf("Macintosh")>=0||lr.indexOf("iPad")>=0||lr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ml=lr.indexOf("Linux")>=0,(lr==null?void 0:lr.indexOf("Mobi"))>=0,Ol=globalThis._VSCODE_NLS_LANGUAGE||Os,hl=navigator.language.toLowerCase(),t_=hl):console.error("Unable to resolve platform.");var Ix=Xd,Dr=Jd,aM=Ml,n_=Ax,Pr=lr,ri=Ol,lM;(e=>{function t(){return ri}e.value=t;function n(){return ri.length===2?ri==="en":ri.length>=3?ri[0]==="e"&&ri[1]==="n"&&ri[2]==="-":!1}e.isDefaultVariant=n;function r(){return ri==="en"}e.isDefault=r})(lM||(lM={}));var cM=typeof Qi.postMessage=="function"&&!Qi.importScripts;(()=>{if(cM){let e=[];Qi.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Qi.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var uM=!!(Pr&&Pr.indexOf("Chrome")>=0);Pr&&Pr.indexOf("Firefox")>=0;!uM&&Pr&&Pr.indexOf("Safari")>=0;Pr&&Pr.indexOf("Edg/")>=0;Pr&&Pr.indexOf("Android")>=0;var _s=typeof navigator=="object"?navigator:{};n_||document.queryCommandSupported&&document.queryCommandSupported("copy")||_s&&_s.clipboard&&_s.clipboard.writeText,n_||_s&&_s.clipboard&&_s.clipboard.readText;var rm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},dh=new rm,r_=new rm,i_=new rm,hM=new Array(230),Mx;(e=>{function t(a){return dh.keyCodeToStr(a)}e.toString=t;function n(a){return dh.strToKeyCode(a)}e.fromString=n;function r(a){return r_.keyCodeToStr(a)}e.toUserSettingsUS=r;function i(a){return i_.keyCodeToStr(a)}e.toUserSettingsGeneral=i;function s(a){return r_.strToKeyCode(a)||i_.strToKeyCode(a)}e.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return dh.keyCodeToStr(a)}e.toElectronAccelerator=o})(Mx||(Mx={}));var dM=class Ox{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof Ox&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new fM([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},fM=class{constructor(e){if(e.length===0)throw zI("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function pM(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Mx.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Gd)switch(t){case 59:return 85;case 60:if(aM)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Dr)return 57;break}else if(nM&&(Dr&&t===93||!Dr&&t===92))return 57;return hM[t]||0}var mM=Dr?256:2048,gM=512,yM=1024,_M=Dr?2048:256,s_=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=pM(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=mM),this.altKey&&(t|=gM),this.shiftKey&&(t|=yM),this.metaKey&&(t|=_M),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new dM(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},o_=new WeakMap;function vM(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var bM=class{static getSameOriginWindowChain(e){let t=o_.get(e);if(!t){t=[],o_.set(e,t);let n=e,r;do r=vM(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let a=s.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},dl=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=bM.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},a_=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(nm){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,a=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Gd&&!Dr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")rM&&Ix?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Gd&&!Dr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},zx=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),wM;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof SM?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:sn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:zx})})(wM||(wM={}));var SM=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?zx:(this._emitter||(this._emitter=new te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},im=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Wd("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Wd("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},xM=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Wd("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=pt(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},kM;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(kM||(kM={}));var l_=class Gn{static fromArray(t){return new Gn(n=>{n.emitMany(t)})}static fromPromise(t){return new Gn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Gn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Gn(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new te,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await sn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Gn(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return Gn.map(this,t)}static filter(t,n){return new Gn(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return Gn.filter(this,t)}static coalesce(t){return Gn.filter(t,n=>!!n)}coalesce(){return Gn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Gn.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};l_.EMPTY=l_.fromArray([]);var{getWindow:Nr,getWindowId:CM,onDidRegisterWindow:EM}=function(){let e=new Map,t={window:$r,disposables:new xi};e.set($r.vscodeWindowId,t);let n=new te,r=new te,i=new te;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return ze.None;let a=new xi,l={window:o,disposables:a.add(new xi)};return e.set(o.vscodeWindowId,l),a.add(pt(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),a.add(je(o,Yt.BEFORE_UNLOAD,()=>{i.fire(o)})),n.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let a=o;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l!=null&&l.view?l.view.window:$r},getDocument(o){return Nr(o).document}}}(),NM=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function je(e,t,n,r){return new NM(e,t,n,r)}var c_=function(e,t,n,r){return je(e,t,n,r)},sm,jM=class extends xM{constructor(e){super(),this.defaultTarget=e&&Nr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},u_=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Il(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(u_.sort),o.shift().execute();r.set(s,!1)};sm=(s,o,a=0)=>{let l=CM(s),c=new u_(o,a),d=e.get(l);return d||(d=[],e.set(l,d)),d.push(c),n.get(l)||(n.set(l,!0),s.requestAnimationFrame(()=>i(l))),c}})();function RM(e){let t=e.getBoundingClientRect(),n=Nr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Yt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},TM=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Cn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Cn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Cn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Cn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Cn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Cn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Cn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Cn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Cn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Cn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Cn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Cn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Cn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Cn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Cn(e){return typeof e=="number"?`${e}px`:e}function Jo(e){return new TM(e)}var Bx=class{constructor(){this._hooks=new xi,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(pt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Nr(e)}this._hooks.add(je(s,Yt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(je(s,Yt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function DM(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var wr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(wr||(wr={}));var Ao=class un extends ze{constructor(){super(),this.dispatched=!1,this.targets=new e_,this.ignoreTargets=new e_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(sn.runAndSubscribe(EM,({window:t,disposables:n})=>{n.add(je(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(je(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(je(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:$r,disposables:this._store}))}static addTarget(t){if(!un.isTouchDevice())return ze.None;un.INSTANCE||(un.INSTANCE=new un);let n=un.INSTANCE.targets.push(t);return pt(n)}static ignoreTarget(t){if(!un.isTouchDevice())return ze.None;un.INSTANCE||(un.INSTANCE=new un);let n=un.INSTANCE.ignoreTargets.push(t);return pt(n)}static isTouchDevice(){return"ontouchstart"in $r||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(wr.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let a=n.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<un.HOLD_DELAY&&Math.abs(l.initialPageX-Mn(l.rollingPageX))<30&&Math.abs(l.initialPageY-Mn(l.rollingPageY))<30){let d=this.newGestureEvent(wr.Tap,l.initialTarget);d.pageX=Mn(l.rollingPageX),d.pageY=Mn(l.rollingPageY),this.dispatchEvent(d)}else if(c>=un.HOLD_DELAY&&Math.abs(l.initialPageX-Mn(l.rollingPageX))<30&&Math.abs(l.initialPageY-Mn(l.rollingPageY))<30){let d=this.newGestureEvent(wr.Contextmenu,l.initialTarget);d.pageX=Mn(l.rollingPageX),d.pageY=Mn(l.rollingPageY),this.dispatchEvent(d)}else if(i===1){let d=Mn(l.rollingPageX),h=Mn(l.rollingPageY),f=Mn(l.rollingTimestamps)-l.rollingTimestamps[0],m=d-l.rollingPageX[0],p=h-l.rollingPageY[0],y=[...this.targets].filter(b=>l.initialTarget instanceof Node&&b.contains(l.initialTarget));this.inertia(t,y,r,Math.abs(m)/f,m>0?1:-1,d,Math.abs(p)/f,p>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(wr.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===wr.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>un.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===wr.Change||t.type===wr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,a,l,c){this.handle=sm(t,()=>{let d=Date.now(),h=d-r,f=0,m=0,p=!0;i+=un.SCROLL_FRICTION*h,a+=un.SCROLL_FRICTION*h,i>0&&(p=!1,f=s*i*h),a>0&&(p=!1,m=l*a*h);let y=this.newGestureEvent(wr.Change);y.translationX=f,y.translationY=m,n.forEach(b=>b.dispatchEvent(y)),p||this.inertia(t,n,d,i,s,o+f,a,l,c+m)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],a=this.newGestureEvent(wr.Change,o.initialTarget);a.translationX=s.pageX-Mn(o.rollingPageX),a.translationY=s.pageY-Mn(o.rollingPageY),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ao.SCROLL_FRICTION=-.005,Ao.HOLD_DELAY=700,Ao.CLEAR_TAP_COUNT_TIME=400,Rt([DM],Ao,"isTouchDevice",1);var PM=Ao,om=class extends ze{onclick(e,t){this._register(je(e,Yt.CLICK,n=>t(new dl(Nr(e),n))))}onmousedown(e,t){this._register(je(e,Yt.MOUSE_DOWN,n=>t(new dl(Nr(e),n))))}onmouseover(e,t){this._register(je(e,Yt.MOUSE_OVER,n=>t(new dl(Nr(e),n))))}onmouseleave(e,t){this._register(je(e,Yt.MOUSE_LEAVE,n=>t(new dl(Nr(e),n))))}onkeydown(e,t){this._register(je(e,Yt.KEY_DOWN,n=>t(new s_(n))))}onkeyup(e,t){this._register(je(e,Yt.KEY_UP,n=>t(new s_(n))))}oninput(e,t){this._register(je(e,Yt.INPUT,t))}onblur(e,t){this._register(je(e,Yt.BLUR,t))}onfocus(e,t){this._register(je(e,Yt.FOCUS,t))}onchange(e,t){this._register(je(e,Yt.CHANGE,t))}ignoreGesture(e){return PM.ignoreTarget(e)}},h_=11,LM=class extends om{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=h_+"px",this.domNode.style.height=h_+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Bx),this._register(c_(this.bgDomNode,Yt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(c_(this.domNode,Yt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new jM),this._pointerdownScheduleRepeatTimer=this._register(new im)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Nr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},AM=class Zd{constructor(t,n,r,i,s,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=i,this.rawScrollTop=a,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Zd(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Zd(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},IM=class extends ze{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new AM(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new f_(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=f_.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},d_=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function fh(e,t){let n=t-e;return function(r){return e+n*zM(r)}}function MM(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var f_=class Qd{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),MM(fh(t,i),fh(s,n),.33)}return fh(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new d_(r,i,!1)}return new d_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Qd.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new Qd(t,n,i,r)}};function OM(e){return Math.pow(e,3)}function zM(e){return 1-OM(1-e)}var BM=class extends ze{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new im)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},FM=140,Fx=class extends om{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new BM(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Bx),this._shouldRender=!0,this.domNode=Jo(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(je(this.domNode.domNode,Yt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new LM(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Jo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(je(this.slider.domNode,Yt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=RM(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-n);if(Ix&&o>FM){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},$x=class ef{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ef(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),a=Math.max(0,o-2*n),l=i>0&&i>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/i))),d=(a-c)/(i-r),h=s*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=ef._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},$M=class extends Fx{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new $x(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},HM=class extends Fx{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new $x(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},WM=500,p_=50,UM=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},tf=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(nm){let n=Nr(t.browserEvent),r=tM(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new UM(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),l=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,a),1),d=Math.max(i,o),h=Math.max(s,a);d%l===0&&h%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};tf.INSTANCE=new tf;var VM=tf,qM=class extends om{constructor(e,t,n){super(),this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new te),this.onWillScroll=this._onWillScroll.event,this._options=YM(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new HM(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new $M(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Jo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Jo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Jo(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new im),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ls(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Dr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new a_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ls(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new a_(n))};this._mouseWheelToDispose.push(je(this._listenOnDomNode,Yt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=VM.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let a=!Dr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),c={};if(s){let d=p_*s,h=l.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let d=p_*o,h=l.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),WM)}},KM=class extends qM{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function YM(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Dr&&(t.className+=" mac"),t}var nf=class extends ze{constructor(e,t,n,r,i,s,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new IM({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>sm(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new KM(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(sn.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(pt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(pt(()=>this._styleElement.remove())),this._register(sn.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
112
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};nf=Rt([fe(2,xn),fe(3,Xr),fe(4,wx),fe(5,lo),fe(6,kn),fe(7,Jr)],nf);var rf=class extends ze{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(pt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};rf=Rt([fe(1,xn),fe(2,Xr),fe(3,Pa),fe(4,Jr)],rf);var GM=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},vr={full:0,left:0,center:0,right:0},ii={full:0,left:0,center:0,right:0},So={full:0,left:0,center:0,right:0},Sc=class extends ze{constructor(e,t,n,r,i,s,o,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new GM,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(pt(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);ii.full=this._canvas.width,ii.left=e,ii.center=t,ii.right=e,this._refreshDrawHeightConstants(),So.full=1,So.left=1,So.center=1+ii.left,So.right=1+ii.left+ii.center}_refreshDrawHeightConstants(){vr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);vr.left=t,vr.center=t,vr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*vr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(So[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-vr[e.position||"full"]/2),ii[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+vr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Sc=Rt([fe(2,xn),fe(3,Pa),fe(4,Jr),fe(5,kn),fe(6,lo),fe(7,Xr)],Sc);var V;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
113
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(V||(V={}));var zl;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(zl||(zl={}));var Hx;(e=>e.ST=`${V.ESC}\\`)(Hx||(Hx={}));var sf=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${V.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};sf=Rt([fe(2,xn),fe(3,kn),fe(4,fs),fe(5,Jr)],sf);var Xt=0,Jt=0,Zt=0,Nt=0,m_={css:"#00000000",rgba:0},zt;(e=>{function t(i,s,o,a){return a!==void 0?`#${Oi(i)}${Oi(s)}${Oi(o)}${Oi(a)}`:`#${Oi(i)}${Oi(s)}${Oi(o)}`}e.toCss=t;function n(i,s,o,a=255){return(i<<24|s<<16|o<<8|a)>>>0}e.toRgba=n;function r(i,s,o,a){return{css:e.toCss(i,s,o,a),rgba:e.toRgba(i,s,o,a)}}e.toColor=r})(zt||(zt={}));var ut;(e=>{function t(l,c){if(Nt=(c.rgba&255)/255,Nt===1)return{css:c.css,rgba:c.rgba};let d=c.rgba>>24&255,h=c.rgba>>16&255,f=c.rgba>>8&255,m=l.rgba>>24&255,p=l.rgba>>16&255,y=l.rgba>>8&255;Xt=m+Math.round((d-m)*Nt),Jt=p+Math.round((h-p)*Nt),Zt=y+Math.round((f-y)*Nt);let b=zt.toCss(Xt,Jt,Zt),_=zt.toRgba(Xt,Jt,Zt);return{css:b,rgba:_}}e.blend=t;function n(l){return(l.rgba&255)===255}e.isOpaque=n;function r(l,c,d){let h=Bl.ensureContrastRatio(l.rgba,c.rgba,d);if(h)return zt.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=r;function i(l){let c=(l.rgba|255)>>>0;return[Xt,Jt,Zt]=Bl.toChannels(c),{css:zt.toCss(Xt,Jt,Zt),rgba:c}}e.opaque=i;function s(l,c){return Nt=Math.round(c*255),[Xt,Jt,Zt]=Bl.toChannels(l.rgba),{css:zt.toCss(Xt,Jt,Zt,Nt),rgba:zt.toRgba(Xt,Jt,Zt,Nt)}}e.opacity=s;function o(l,c){return Nt=l.rgba&255,s(l,Nt*c/255)}e.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(ut||(ut={}));var _t;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return Xt=parseInt(i.slice(1,2).repeat(2),16),Jt=parseInt(i.slice(2,3).repeat(2),16),Zt=parseInt(i.slice(3,4).repeat(2),16),zt.toColor(Xt,Jt,Zt);case 5:return Xt=parseInt(i.slice(1,2).repeat(2),16),Jt=parseInt(i.slice(2,3).repeat(2),16),Zt=parseInt(i.slice(3,4).repeat(2),16),Nt=parseInt(i.slice(4,5).repeat(2),16),zt.toColor(Xt,Jt,Zt,Nt);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Xt=parseInt(s[1]),Jt=parseInt(s[2]),Zt=parseInt(s[3]),Nt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),zt.toColor(Xt,Jt,Zt,Nt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Xt,Jt,Zt,Nt]=t.getImageData(0,0,1,1).data,Nt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:zt.toRgba(Xt,Jt,Zt,Nt),css:i}}e.toColor=r})(_t||(_t={}));var yn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/255,a=i/255,l=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+d*.7152+h*.0722}e.relativeLuminance2=n})(yn||(yn={}));var Bl;(e=>{function t(o,a){if(Nt=(a&255)/255,Nt===1)return a;let l=a>>24&255,c=a>>16&255,d=a>>8&255,h=o>>24&255,f=o>>16&255,m=o>>8&255;return Xt=h+Math.round((l-h)*Nt),Jt=f+Math.round((c-f)*Nt),Zt=m+Math.round((d-m)*Nt),zt.toRgba(Xt,Jt,Zt)}e.blend=t;function n(o,a,l){let c=yn.relativeLuminance(o>>8),d=yn.relativeLuminance(a>>8);if(Ir(c,d)<l){if(d<c){let m=r(o,a,l),p=Ir(c,yn.relativeLuminance(m>>8));if(p<l){let y=i(o,a,l),b=Ir(c,yn.relativeLuminance(y>>8));return p>b?m:y}return m}let h=i(o,a,l),f=Ir(c,yn.relativeLuminance(h>>8));if(f<l){let m=r(o,a,l),p=Ir(c,yn.relativeLuminance(m>>8));return f>p?h:m}return h}}e.ensureContrastRatio=n;function r(o,a,l){let c=o>>24&255,d=o>>16&255,h=o>>8&255,f=a>>24&255,m=a>>16&255,p=a>>8&255,y=Ir(yn.relativeLuminance2(f,m,p),yn.relativeLuminance2(c,d,h));for(;y<l&&(f>0||m>0||p>0);)f-=Math.max(0,Math.ceil(f*.1)),m-=Math.max(0,Math.ceil(m*.1)),p-=Math.max(0,Math.ceil(p*.1)),y=Ir(yn.relativeLuminance2(f,m,p),yn.relativeLuminance2(c,d,h));return(f<<24|m<<16|p<<8|255)>>>0}e.reduceLuminance=r;function i(o,a,l){let c=o>>24&255,d=o>>16&255,h=o>>8&255,f=a>>24&255,m=a>>16&255,p=a>>8&255,y=Ir(yn.relativeLuminance2(f,m,p),yn.relativeLuminance2(c,d,h));for(;y<l&&(f<255||m<255||p<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),y=Ir(yn.relativeLuminance2(f,m,p),yn.relativeLuminance2(c,d,h));return(f<<24|m<<16|p<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(Bl||(Bl={}));function Oi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ir(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var XM=class extends Da{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},xc=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new nr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,s=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-i>1){let d=this._getJoinedRanges(r,o,s,t,i);for(let h=0;h<d.length;h++)n.push(d[h])}i=c,o=s,a=this._workCell.fg,l=this._workCell.bg}s+=this._workCell.getChars().length||pi.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(r,o,s,t,i);for(let d=0;d<c.length;d++)n.push(c[d])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(s)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(s);for(let c=0;c<l.length;c++)xc._mergeRanges(o,l[c])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let a=n;a<this._bufferService.cols;a++){let l=t.getWidth(a),c=t.getString(a).length||pi.length;if(l!==0){if(!i&&o[0]<=s&&(o[0]=a,i=!0),o[1]<=s){if(o[1]=a,o=e[++r],!o)break;o[0]<=s?(o[0]=a,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};xc=Rt([fe(0,xn)],xc);function JM(e){return 57508<=e&&e<=57558}function ZM(e){return 9472<=e&&e<=9631}function QM(e){return JM(e)||ZM(e)}function eO(){return{css:{canvas:fl(),cell:fl()},device:{canvas:fl(),cell:fl(),char:{width:0,height:0,left:0,top:0}}}}function fl(){return{width:0,height:0}}var of=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new nr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,a,l,c,d){let h=[],f=this._characterJoinerService.getJoinedCharacters(t),m=this._themeService.colors,p=e.getNoBgTrimmedLength();n&&p<s+1&&(p=s+1);let y,b=0,_="",v=0,g=0,S=0,k=0,x=!1,T=0,L=!1,B=0,j=0,F=[],A=c!==-1&&d!==-1;for(let R=0;R<p;R++){e.loadCell(R,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let N=!1,O=R>=j,W=R,D=this._workCell;if(f.length>0&&R===f[0][0]&&O){let be=f.shift(),Ue=this._isCellInSelection(be[0],t);for(v=be[0]+1;v<be[1];v++)O&&(O=Ue===this._isCellInSelection(v,t));O&&(O=!n||s<be[0]||s>=be[1]),O?(N=!0,D=new XM(this._workCell,e.translateToString(!0,be[0],be[1]),be[1]-be[0]),W=be[1]-1,P=D.getWidth()):j=be[1]}let I=this._isCellInSelection(R,t),C=n&&R===s,X=A&&R>=c&&R<=d,ie=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,be=>{ie=!0});let E=D.getChars()||pi;if(E===" "&&(D.isUnderline()||D.isOverline())&&(E=" "),B=P*a-l.get(E,D.isBold(),D.isItalic()),!y)y=this._document.createElement("span");else if(b&&(I&&L||!I&&!L&&D.bg===g)&&(I&&L&&m.selectionForeground||D.fg===S)&&D.extended.ext===k&&X===x&&B===T&&!C&&!N&&!ie&&O){D.isInvisible()?_+=pi:_+=E,b++;continue}else b&&(y.textContent=_),y=this._document.createElement("span"),b=0,_="";if(g=D.bg,S=D.fg,k=D.extended.ext,x=X,T=B,L=I,N&&s>=R&&s<=W&&(s=R),!this._coreService.isCursorHidden&&C&&this._coreService.isCursorInitialized){if(F.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&F.push("xterm-cursor-blink"),F.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":F.push("xterm-cursor-outline");break;case"block":F.push("xterm-cursor-block");break;case"bar":F.push("xterm-cursor-bar");break;case"underline":F.push("xterm-cursor-underline");break}}if(D.isBold()&&F.push("xterm-bold"),D.isItalic()&&F.push("xterm-italic"),D.isDim()&&F.push("xterm-dim"),D.isInvisible()?_=pi:_=D.getChars()||pi,D.isUnderline()&&(F.push(`xterm-underline-${D.extended.underlineStyle}`),_===" "&&(_=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${Da.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let be=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&be<8&&(be+=8),y.style.textDecorationColor=m.ansi[be].css}D.isOverline()&&(F.push("xterm-overline"),_===" "&&(_=" ")),D.isStrikethrough()&&F.push("xterm-strikethrough"),X&&(y.style.textDecoration="underline");let ue=D.getFgColor(),ve=D.getFgColorMode(),Z=D.getBgColor(),pe=D.getBgColorMode(),ce=!!D.isInverse();if(ce){let be=ue;ue=Z,Z=be;let Ue=ve;ve=pe,pe=Ue}let ge,Pe,we=!1;this._decorationService.forEachDecorationAtCell(R,t,void 0,be=>{be.options.layer!=="top"&&we||(be.backgroundColorRGB&&(pe=50331648,Z=be.backgroundColorRGB.rgba>>8&16777215,ge=be.backgroundColorRGB),be.foregroundColorRGB&&(ve=50331648,ue=be.foregroundColorRGB.rgba>>8&16777215,Pe=be.foregroundColorRGB),we=be.options.layer==="top")}),!we&&I&&(ge=this._coreBrowserService.isFocused?m.selectionBackgroundOpaque:m.selectionInactiveBackgroundOpaque,Z=ge.rgba>>8&16777215,pe=50331648,we=!0,m.selectionForeground&&(ve=50331648,ue=m.selectionForeground.rgba>>8&16777215,Pe=m.selectionForeground)),we&&F.push("xterm-decoration-top");let Be;switch(pe){case 16777216:case 33554432:Be=m.ansi[Z],F.push(`xterm-bg-${Z}`);break;case 50331648:Be=zt.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(y,`background-color:#${g_((Z>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(Be=m.foreground,F.push("xterm-bg-257")):Be=m.background}switch(ge||D.isDim()&&(ge=ut.multiplyOpacity(Be,.5)),ve){case 16777216:case 33554432:D.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(y,Be,m.ansi[ue],D,ge,void 0)||F.push(`xterm-fg-${ue}`);break;case 50331648:let be=zt.toColor(ue>>16&255,ue>>8&255,ue&255);this._applyMinimumContrast(y,Be,be,D,ge,Pe)||this._addStyle(y,`color:#${g_(ue.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,Be,m.foreground,D,ge,Pe)||ce&&F.push("xterm-fg-257")}F.length&&(y.className=F.join(" "),F.length=0),!C&&!N&&!ie&&O?b++:y.textContent=_,B!==this.defaultSpacing&&(y.style.letterSpacing=`${B}px`),h.push(y),R=W}return y&&b&&(y.textContent=_),h}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||QM(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!i&&!s&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=ut.ensureContrastRatio(i||t,s||n,l),o.setColor((i||t).rgba,(s||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};of=Rt([fe(1,kx),fe(2,kn),fe(3,Xr),fe(4,fs),fe(5,Pa),fe(6,lo)],of);function g_(e,t,n){for(;e.length<n;)e=t+e;return e}var tO=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},nO=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[1]-i,a=Math.max(s,0),l=Math.min(o,e.rows-1);if(a>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function rO(){return new nO}var ph="xterm-dom-renderer-owner-",Yn="xterm-rows",pl="xterm-fg-",y_="xterm-bg-",xo="xterm-focus",ml="xterm-selection",iO=1,af=class extends ze{constructor(e,t,n,r,i,s,o,a,l,c,d,h,f,m){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=d,this._coreService=h,this._coreBrowserService=f,this._themeService=m,this._terminalClass=iO++,this._rowElements=[],this._selectionRenderModel=rO(),this.onRequestRedraw=this._register(new te).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Yn),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(ml),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=eO(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(of,document),this._element.classList.add(ph+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(pt(()=>{this._element.classList.remove(ph+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new tO(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Yn} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Yn} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Yn} .xterm-dim { color: ${ut.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Yn}.${xo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Yn}.${xo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Yn}.${xo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Yn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Yn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Yn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Yn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Yn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ml} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ml} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ml} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${pl}${s} { color: ${o.css}; }${this._terminalSelector} .${pl}${s}.xterm-dim { color: ${ut.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${y_}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${pl}257 { color: ${ut.opaque(e.background).css}; }${this._terminalSelector} .${pl}257.xterm-dim { color: ${ut.multiplyOpacity(ut.opaque(e.background),.5).css}; }${this._terminalSelector} .${y_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(xo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(xo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let l=e[0]>t[0];a.appendChild(this._createSelectionElement(s,l?t[0]:e[0],l?e[0]:t[0],o-s+1))}else{let l=r===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));let d=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,d)),s!==o){let h=i===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let c=l+n.ydisp,d=this._rowElements[l],h=n.lines.get(c);if(!d||!h)break;d.replaceChildren(...this._rowFactory.createRow(h,c,c===r,o,a,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ph}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,i-1),d=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=n;m<=r;++m){let p=m+a.ydisp,y=this._rowElements[m],b=a.lines.get(p);if(!y||!b)break;y.replaceChildren(...this._rowFactory.createRow(b,p,p===l,h,f,c,d,this.dimensions.css.cell.width,this._widthCache,s?m===n?e:0:-1,s?(m===r?t:i)-1:-1))}}};af=Rt([fe(7,Qp),fe(8,au),fe(9,kn),fe(10,xn),fe(11,fs),fe(12,Xr),fe(13,lo)],af);var lf=class extends ze{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new te),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new oO(this._optionsService))}catch{this._measureStrategy=this._register(new sO(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};lf=Rt([fe(2,kn)],lf);var Wx=class extends ze{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},sO=class extends Wx{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},oO=class extends Wx{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},aO=class extends ze{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new lO(this._window)),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new te),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(sn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(je(this._textarea,"focus",()=>this._isFocused=!0)),this._register(je(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},lO=class extends ze{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new to),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(pt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=je(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},cO=class extends ze{constructor(){super(),this.linkProviders=[],this._register(pt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function am(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function uO(e,t,n,r,i,s,o,a,l){if(!s)return;let c=am(e,t,n);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var cf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return uO(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=am(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};cf=Rt([fe(0,Jr),fe(1,au)],cf);var hO=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Ux={};wI(Ux,{getSafariVersion:()=>fO,isChromeOS:()=>Yx,isFirefox:()=>Vx,isIpad:()=>pO,isIphone:()=>mO,isLegacyEdge:()=>dO,isLinux:()=>lm,isMac:()=>kc,isNode:()=>lu,isSafari:()=>qx,isWindows:()=>Kx});var lu=typeof process<"u"&&"title"in process,La=lu?"node":navigator.userAgent,Aa=lu?"node":navigator.platform,Vx=La.includes("Firefox"),dO=La.includes("Edge"),qx=/^((?!chrome|android).)*safari/i.test(La);function fO(){if(!qx)return 0;let e=La.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var kc=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Aa),pO=Aa==="iPad",mO=Aa==="iPhone",Kx=["Windows","Win16","Win32","WinCE"].includes(Aa),lm=Aa.indexOf("Linux")>=0,Yx=/\bCrOS\b/.test(La),Gx=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},gO=class extends Gx{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},yO=class extends Gx{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Cc=!lu&&"requestIdleCallback"in window?yO:gO,_O=class{constructor(){this._queue=new Cc}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},uf=class extends ze{constructor(e,t,n,r,i,s,o,a,l){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=a,this._renderer=this._register(new to),this._pausedResizeTask=new _O,this._observerDisposable=this._register(new to),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new te),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new te),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new te),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new hO((c,d)=>this._renderRows(c,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new vO(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(pt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=pt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};uf=Rt([fe(2,kn),fe(3,au),fe(4,fs),fe(5,Pa),fe(6,xn),fe(7,Xr),fe(8,lo)],uf);var vO=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function bO(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return xO(i,s,e,t,n,r)+cu(s,t,n,r)+kO(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",_a(Math.abs(i-e),ya(o,r));o=s>t?"D":"C";let a=Math.abs(s-t),l=SO(s>t?e:i,n)+(a-1)*n.cols+1+wO(s>t?i:e);return _a(l,ya(o,r))}function wO(e,t){return e-1}function SO(e,t){return t.cols-e}function xO(e,t,n,r,i,s){return cu(t,r,i,s).length===0?"":_a(Jx(e,t,e,t-cs(t,i),!1,i).length,ya("D",s))}function cu(e,t,n,r){let i=e-cs(e,n),s=t-cs(t,n),o=Math.abs(i-s)-CO(e,t,n);return _a(o,ya(Xx(e,t),r))}function kO(e,t,n,r,i,s){let o;cu(t,r,i,s).length>0?o=r-cs(r,i):o=t;let a=r,l=EO(e,t,n,r,i,s);return _a(Jx(e,o,n,a,l==="C",i).length,ya(l,s))}function CO(e,t,n){var o;let r=0,i=e-cs(e,n),s=t-cs(t,n);for(let a=0;a<Math.abs(i-s);a++){let l=Xx(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+l*a))!=null&&o.isWrapped&&r++}return r}function cs(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function EO(e,t,n,r,i,s){let o;return cu(n,r,i,s).length>0?o=r-cs(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function Xx(e,t){return e>t?"A":"B"}function Jx(e,t,n,r,i,s){let o=e,a=t,l="";for(;(o!==n||a!==r)&&a>=0&&a<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!i&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),o=s.cols-1,e=o,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function ya(e,t){let n=t?"O":"[";return V.ESC+n+e}function _a(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var NO=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function __(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var mh=50,jO=15,RO=50,TO=500,DO=" ",PO=new RegExp(DO,"g"),hf=class extends ze{constructor(e,t,n,r,i,s,o,a,l){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new nr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new te),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new te),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new NO(this._bufferService),this._activeSelectionMode=0,this._register(pt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=n.translateBufferLineToString(o,!0,i,s);r.push(a)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),a=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=a:r.push(a)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace(PO," ")).join(Kx?`\r
|
|
114
|
+
`:`
|
|
115
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),lm&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=__(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=am(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-mh),mh),t/=mh,t/Math.abs(t)+Math.round(t*(jO-1)))}shouldForceSelection(e){return kc?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),RO)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(kc&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<TO&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=bO(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e[0]),l=a,c=e[0]-a,d=0,h=0,f=0,m=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let b=e[0],_=e[0];s.getWidth(b)===0&&(d++,b--),s.getWidth(_)===2&&(h++,_++);let v=s.getString(_).length;for(v>1&&(m+=v-1,l+=v-1);b>0&&a>0&&!this._isCharWordSeparator(s.loadCell(b-1,this._workCell));){s.loadCell(b-1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,b--):g>1&&(f+=g-1,a-=g-1),a--,b--}for(;_<s.length&&l+1<o.length&&!this._isCharWordSeparator(s.loadCell(_+1,this._workCell));){s.loadCell(_+1,this._workCell);let g=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,_++):g>1&&(m+=g-1,l+=g-1),l++,_++}}l++;let p=a+c-d+f,y=Math.min(this._bufferService.cols,l-a+d+h-f-m);if(!(!t&&o.slice(a,l).trim()==="")){if(n&&p===0&&s.getCodePoint(0)!==32){let b=i.lines.get(e[1]-1);if(b&&s.isWrapped&&b.getCodePoint(this._bufferService.cols-1)!==32){let _=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(_){let v=this._bufferService.cols-_.start;p-=v,y+=v}}}if(r&&p+y===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let b=i.lines.get(e[1]+1);if(b!=null&&b.isWrapped&&b.getCodePoint(0)!==32){let _=this._getWordAt([0,e[1]+1],!1,!1,!0);_&&(y+=_.length)}}return{start:p,length:y}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=__(n,this._bufferService.cols)}};hf=Rt([fe(3,xn),fe(4,fs),fe(5,em),fe(6,kn),fe(7,Jr),fe(8,Xr)],hf);var v_=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},b_=class{constructor(){this._color=new v_,this._css=new v_}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Wt=Object.freeze((()=>{let e=[_t.toColor("#2e3436"),_t.toColor("#cc0000"),_t.toColor("#4e9a06"),_t.toColor("#c4a000"),_t.toColor("#3465a4"),_t.toColor("#75507b"),_t.toColor("#06989a"),_t.toColor("#d3d7cf"),_t.toColor("#555753"),_t.toColor("#ef2929"),_t.toColor("#8ae234"),_t.toColor("#fce94f"),_t.toColor("#729fcf"),_t.toColor("#ad7fa8"),_t.toColor("#34e2e2"),_t.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:zt.toCss(r,i,s),rgba:zt.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:zt.toCss(r,r,r),rgba:zt.toRgba(r,r,r)})}return e})()),Hi=_t.toColor("#ffffff"),Io=_t.toColor("#000000"),w_=_t.toColor("#ffffff"),S_=Io,ko={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},LO=Hi,df=class extends ze{constructor(e){super(),this._optionsService=e,this._contrastCache=new b_,this._halfContrastCache=new b_,this._onChangeColors=this._register(new te),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Hi,background:Io,cursor:w_,cursorAccent:S_,selectionForeground:void 0,selectionBackgroundTransparent:ko,selectionBackgroundOpaque:ut.blend(Io,ko),selectionInactiveBackgroundTransparent:ko,selectionInactiveBackgroundOpaque:ut.blend(Io,ko),scrollbarSliderBackground:ut.opacity(Hi,.2),scrollbarSliderHoverBackground:ut.opacity(Hi,.4),scrollbarSliderActiveBackground:ut.opacity(Hi,.5),overviewRulerBorder:Hi,ansi:Wt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=et(e.foreground,Hi),t.background=et(e.background,Io),t.cursor=ut.blend(t.background,et(e.cursor,w_)),t.cursorAccent=ut.blend(t.background,et(e.cursorAccent,S_)),t.selectionBackgroundTransparent=et(e.selectionBackground,ko),t.selectionBackgroundOpaque=ut.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=et(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ut.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?et(e.selectionForeground,m_):void 0,t.selectionForeground===m_&&(t.selectionForeground=void 0),ut.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ut.opacity(t.selectionBackgroundTransparent,.3)),ut.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ut.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=et(e.scrollbarSliderBackground,ut.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=et(e.scrollbarSliderHoverBackground,ut.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=et(e.scrollbarSliderActiveBackground,ut.opacity(t.foreground,.5)),t.overviewRulerBorder=et(e.overviewRulerBorder,LO),t.ansi=Wt.slice(),t.ansi[0]=et(e.black,Wt[0]),t.ansi[1]=et(e.red,Wt[1]),t.ansi[2]=et(e.green,Wt[2]),t.ansi[3]=et(e.yellow,Wt[3]),t.ansi[4]=et(e.blue,Wt[4]),t.ansi[5]=et(e.magenta,Wt[5]),t.ansi[6]=et(e.cyan,Wt[6]),t.ansi[7]=et(e.white,Wt[7]),t.ansi[8]=et(e.brightBlack,Wt[8]),t.ansi[9]=et(e.brightRed,Wt[9]),t.ansi[10]=et(e.brightGreen,Wt[10]),t.ansi[11]=et(e.brightYellow,Wt[11]),t.ansi[12]=et(e.brightBlue,Wt[12]),t.ansi[13]=et(e.brightMagenta,Wt[13]),t.ansi[14]=et(e.brightCyan,Wt[14]),t.ansi[15]=et(e.brightWhite,Wt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=et(e.extendedAnsi[r],Wt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};df=Rt([fe(0,kn)],df);function et(e,t){if(e!==void 0)try{return _t.toColor(e)}catch{}return t}var AO=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},IO=class{constructor(){this._services=new AO,this._services.set(Qp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=jI(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},MO={trace:0,debug:1,info:2,warn:3,error:4,off:5},OO="xterm.js: ",ff=class extends ze{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=MO[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":OO)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};ff=Rt([fe(0,kn)],ff);var x_=class extends ze{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new te),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new te),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new te),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Oe=3,Ot=Object.freeze(new Da),gl=0,gh=2,Mo=class Zx{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Oe);let i=n||nr.fromCharData([0,yx,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*Oe+0],r=n&2097151;return[this._data[t*Oe+1],n&2097152?this._combined[t]:r?ci(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Oe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Oe+0]=t|2097152|n[2]<<22):this._data[t*Oe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Oe+0]>>22}hasWidth(t){return this._data[t*Oe+0]&12582912}getFg(t){return this._data[t*Oe+1]}getBg(t){return this._data[t*Oe+2]}hasContent(t){return this._data[t*Oe+0]&4194303}getCodePoint(t){let n=this._data[t*Oe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Oe+0]&2097152}getString(t){let n=this._data[t*Oe+0];return n&2097152?this._combined[t]:n&2097151?ci(n&2097151):""}isProtected(t){return this._data[t*Oe+2]&536870912}loadCell(t,n){return gl=t*Oe,n.content=this._data[gl+0],n.fg=this._data[gl+1],n.bg=this._data[gl+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Oe+0]=n.content,this._data[t*Oe+1]=n.fg,this._data[t*Oe+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Oe+0]=n|r<<22,this._data[t*Oe+1]=i.fg,this._data[t*Oe+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*Oe+0];i&2097152?this._combined[t]+=ci(n):i&2097151?(this._combined[t]=ci(i&2097151)+ci(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*Oe+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new nr;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new nr;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*gh<this._data.buffer.byteLength;let r=t*Oe;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._combined[a]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,r*4*gh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*gh<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Zx(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Oe+0]&4194303)return t+(this._data[t*Oe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Oe+0]&4194303||this._data[t*Oe+2]&50331648)return t+(this._data[t*Oe+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let l=i-1;l>=0;l--){for(let c=0;c<Oe;c++)this._data[(r+l)*Oe+c]=o[(n+l)*Oe+c];o[(n+l)*Oe+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}else for(let l=0;l<i;l++){for(let c=0;c<Oe;c++)this._data[(r+l)*Oe+c]=o[(n+l)*Oe+c];o[(n+l)*Oe+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}let a=Object.keys(t._combined);for(let l=0;l<a.length;l++){let c=parseInt(a[l],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*Oe+0],a=o&2097151,l=o&2097152?this._combined[n]:a?ci(a):pi;if(s+=l,i)for(let c=0;c<l.length;++c)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function zO(e,t,n,r,i,s){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let d=[e.get(a)];for(;l<e.length&&c.isWrapped;)d.push(c),c=e.get(++l);if(!s&&r>=a&&r<l){a+=d.length-1;continue}let h=0,f=va(d,h,t),m=1,p=0;for(;m<d.length;){let b=va(d,m,t),_=b-p,v=n-f,g=Math.min(_,v);d[h].copyCellsFrom(d[m],p,f,g,!1),f+=g,f===n&&(h++,f=0),p+=g,p===b&&(m++,p=0),f===0&&h!==0&&d[h-1].getWidth(n-1)===2&&(d[h].copyCellsFrom(d[h-1],n-1,f++,1,!1),d[h-1].setCell(n-1,i))}d[h].replaceCells(f,n,i);let y=0;for(let b=d.length-1;b>0&&(b>h||d[b].getTrimmedLength()===0);b--)y++;y>0&&(o.push(a+d.length-y),o.push(y)),a+=d.length-1}return o}function BO(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let a=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function FO(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function $O(e,t,n){let r=[],i=e.map((l,c)=>va(e,c,t)).reduce((l,c)=>l+c),s=0,o=0,a=0;for(;a<i;){if(i-a<n){r.push(i-a);break}s+=n;let l=va(e,o,t);s>l&&(s-=l,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let d=c?n-1:n;r.push(d),a+=d}return r}function va(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var Qx=class e0{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e0._nextId++,this._onDispose=this.register(new te),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ls(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Qx._nextId=1;var HO=Qx,Kt={},Wi=Kt.B;Kt[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Kt.A={"#":"£"};Kt.B=void 0;Kt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Kt.C=Kt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Kt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Kt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Kt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Kt.E=Kt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Kt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Kt.H=Kt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var k_=4294967295,C_=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ot.clone(),this.savedCharset=Wi,this.markers=[],this._nullCell=nr.fromCharData([0,yx,1,0]),this._whitespaceCell=nr.fromCharData([0,pi,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Cc,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new x_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new wc),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new wc),this._whitespaceCell}getBlankLine(e,t){return new Mo(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>k_?k_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ot);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new x_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Ot),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Mo(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Mo(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=zO(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ot),n);if(r.length>0){let i=BO(this.lines,r);FO(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Ot),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Mo(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Ot),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!n){let g=this.ybase+this.y;if(g>=o&&g<o+l.length)continue}let c=l[l.length-1].getTrimmedLength(),d=$O(l,this._cols,e),h=d.length-l.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+h):f=Math.max(0,this.lines.length-this.lines.maxLength+h);let m=[];for(let g=0;g<h;g++){let S=this.getBlankLine(Ot,!0);m.push(S)}m.length>0&&(i.push({start:o+l.length+s,newLines:m}),s+=m.length),l.push(...m);let p=d.length-1,y=d[p];y===0&&(p--,y=d[p]);let b=l.length-h-1,_=c;for(;b>=0;){let g=Math.min(_,y);if(l[p]===void 0)break;if(l[p].copyCellsFrom(l[b],_-g,y-g,g,!0),y-=g,y===0&&(p--,y=d[p]),_-=g,_===0){b--;let S=Math.max(b,0);_=va(l,S,this._cols)}}for(let g=0;g<l.length;g++)d[g]<e&&l[g].setCell(d[g],r);let v=h-f;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(i.length>0){let o=[],a=[];for(let y=0;y<this.lines.length;y++)a.push(this.lines.get(y));let l=this.lines.length,c=l-1,d=0,h=i[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let y=Math.min(this.lines.maxLength-1,l+s-1);y>=0;y--)if(h&&h.start>c+f){for(let b=h.newLines.length-1;b>=0;b--)this.lines.set(y--,h.newLines[b]);y++,o.push({index:c+1,amount:h.newLines.length}),f+=h.newLines.length,h=i[++d]}else this.lines.set(y,a[c--]);let m=0;for(let y=o.length-1;y>=0;y--)o[y].index+=m,this.lines.onInsertEmitter.fire(o[y]),m+=o[y].amount;let p=Math.max(0,l+s-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new HO(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},WO=class extends ze{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new te),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new C_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new C_(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},t0=2,n0=1,pf=class extends ze{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t0),this.rows=Math.max(e.rawOptions.rows||0,n0),this.buffers=this._register(new WO(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};pf=Rt([fe(0,kn)],pf);var vs={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:kc,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},UO=["normal","bold","100","200","300","400","500","600","700","800","900"],VO=class extends ze{constructor(e){super(),this._onOptionChange=this._register(new te),this.onOptionChange=this._onOptionChange.event;let t={...vs};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(pt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in vs))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in vs))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=vs[e]),!qO(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=vs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=UO.includes(t)?t:vs[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function qO(e){return e==="block"||e==="underline"||e==="bar"}function Oo(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Oo(e[r],t-1);return n}var E_=Object.freeze({insertMode:!1}),N_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),mf=class extends ze{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new te),this.onData=this._onData.event,this._onUserInput=this._register(new te),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new te),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Oo(E_),this.decPrivateModes=Oo(N_)}reset(){this.modes=Oo(E_),this.decPrivateModes=Oo(N_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};mf=Rt([fe(0,xn),fe(1,Sx),fe(2,kn)],mf);var j_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function yh(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var _h=String.fromCharCode,R_={DEFAULT:e=>{let t=[yh(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${_h(t[0])}${_h(t[1])}${_h(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${yh(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${yh(e,!0)};${e.x};${e.y}${t}`}},gf=class extends ze{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new te),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(j_))this.addProtocol(r,j_[r]);for(let r of Object.keys(R_))this.addEncoding(r,R_[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};gf=Rt([fe(0,xn),fe(1,fs),fe(2,kn)],gf);var vh=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],KO=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Ut;function YO(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var GO=class{constructor(){if(this.version="6",!Ut){Ut=new Uint8Array(65536),Ut.fill(1),Ut[0]=0,Ut.fill(0,1,32),Ut.fill(0,127,160),Ut.fill(2,4352,4448),Ut[9001]=2,Ut[9002]=2,Ut.fill(2,11904,42192),Ut[12351]=1,Ut.fill(2,44032,55204),Ut.fill(2,63744,64256),Ut.fill(2,65040,65050),Ut.fill(2,65072,65136),Ut.fill(2,65280,65377),Ut.fill(2,65504,65511);for(let e=0;e<vh.length;++e)Ut.fill(0,vh[e][0],vh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ut[e]:YO(e,KO)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=Gi.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return Gi.createPropertyValue(0,n,r)}},Gi=class Fl{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new te,this.onChange=this._onChange.event;let t=new GO;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return n+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Fl.extractWidth(a);Fl.extractShouldJoin(a)&&(l-=Fl.extractWidth(r)),n+=l,r=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},XO=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function T_(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Co=2147483647,JO=256,r0=class yf{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>JO)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new yf;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new yf(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Co?Co:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Co?Co:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,Co):t}},Eo=[],ZO=class{constructor(){this._state=0,this._active=Eo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Eo}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Eo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Eo,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",ou(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Eo,this._id=-1,this._state=0}}},On=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=ou(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},No=[],QO=class{constructor(){this._handlers=Object.create(null),this._active=No,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=No}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=No,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||No,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",ou(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=No,this._ident=0}},zo=new r0;zo.addParam(0);var D_=class{constructor(e){this._handler=e,this._data="",this._params=zo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():zo,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=ou(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=zo,this._data="",this._hitLimit=!1,n));return this._params=zo,this._data="",this._hitLimit=!1,t}},ez=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},Xn=160,tz=function(){let e=new ez(4095),t=Array.apply(null,Array(256)).map((a,l)=>l),n=(a,l)=>t.slice(a,l),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Xn,0,2,0),e.add(Xn,8,5,8),e.add(Xn,6,0,6),e.add(Xn,11,0,11),e.add(Xn,13,13,13),e}(),nz=class extends ze{constructor(e=tz){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(pt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new ZO),this._dcsParser=this._register(new QO),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=s;a<t;++a){switch(r=e[a],i=this._transitions.table[this.currentState<<8|(r<160?r:Xn)],i>>4){case 2:for(let f=a+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r<Xn){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Xn){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Xn){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Xn){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,l,c,i,a),o;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let d=this._escHandlers[this._collect<<8|r],h=d?d.length-1:-1;for(;h>=0&&(o=d[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,d,h,i,a),o;h<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(r=e[f])===24||r===26||r===27||r>127&&r<Xn){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=a+1;;f++)if(f>=t||(r=e[f])<32||r>127&&r<Xn){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},rz=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,iz=/^[\da-f]+$/;function P_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=rz.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),iz.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function bh(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function sz(e,t=16){let[n,r,i]=e;return`rgb:${bh(n,t)}/${bh(r,t)}/${bh(i,t)}`}var oz={"(":0,")":1,"*":2,"+":3,"-":1,".":2},si=131072,L_=10;function A_(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var I_=5e3,M_=0,az=class extends ze{constructor(e,t,n,r,i,s,o,a,l=new nz){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new EI,this._utf8Decoder=new NI,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ot.clone(),this._eraseAttrDataInternal=Ot.clone(),this._onRequestBell=this._register(new te),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new te),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new te),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new te),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new te),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new te),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new te),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new te),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new te),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new _f(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:h})}),this._parser.setDcsHandlerFallback((c,d,h)=>{d==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:h})}),this._parser.setPrintHandler((c,d,h)=>this.print(c,d,h)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(V.BEL,()=>this.bell()),this._parser.setExecuteHandler(V.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(V.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(V.BS,()=>this.backspace()),this._parser.setExecuteHandler(V.HT,()=>this.tab()),this._parser.setExecuteHandler(V.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(V.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(zl.IND,()=>this.index()),this._parser.setExecuteHandler(zl.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(zl.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new On(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new On(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new On(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new On(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new On(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new On(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new On(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new On(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new On(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new On(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new On(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new On(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in Kt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new D_((c,d)=>this.requestStatusString(c,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),I_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${I_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>si&&(s=this._parseStack.position+si)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<si&&(this._parseBuffer=new Uint32Array(Math.min(e.length,si))),o||this._dirtyRowTracker.clearRange(),e.length>si)for(let c=s;c<e.length;c+=si){let d=c+si<e.length?c+si:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(c,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,d),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(r,i,h,c),this._logSlowResolvingAsync(n),n}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let r,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let m=t;m<n;++m){if(r=e[m],r<127&&s){let _=s[String.fromCharCode(r)];_&&(r=_.charCodeAt(0))}let p=this._unicodeService.charProperties(r,f);i=Gi.extractWidth(p);let y=Gi.extractShouldJoin(p),b=y?Gi.extractWidth(f):0;if(f=p,o&&this._onA11yChar.fire(ci(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-b>a){if(l){let _=h,v=this._activeBuffer.x-b;for(this._activeBuffer.x=b,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),b>0&&h instanceof Mo&&h.copyCellsFrom(_,v,0,b,!1);v<a;)_.setCellFromCodepoint(v++,0,1,d)}else if(this._activeBuffer.x=a-1,i===2)continue}if(y&&this._activeBuffer.x){let _=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-_,r,i);for(let v=i-b;--v>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(h.insertCells(this._activeBuffer.x,i-b,this._activeBuffer.getNullCell(d)),h.getWidth(a-1)===2&&h.setCellFromCodepoint(a-1,0,1,d)),h.setCellFromCodepoint(this._activeBuffer.x++,r,i,d),i>0)for(;--i;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&n-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>A_(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new D_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new On(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Ot));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Gi.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),a=0;for(let c=0;c<s.length;){let d=s.codePointAt(c)||0;o[a++]=d,c+=d>65535?2:1}let l=a;for(let c=1;c<n;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(V.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(V.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(V.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(V.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(V.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Wi),this._charsetService.setgCharset(1,Wi),this._charsetService.setgCharset(2,Wi),this._charsetService.setgCharset(3,Wi);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(y=>(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:d}=a,h=this._optionsService.rawOptions,f=(y,b)=>(o.triggerDataEvent(`${V.ESC}[${t?"":"?"}${y};${b}$y`),!0),m=y=>y?1:2,p=e.params[0];return t?p===2?f(p,4):p===4?f(p,m(o.modes.insertMode)):p===12?f(p,3):p===20?f(p,m(h.convertEol)):f(p,0):p===1?f(p,m(r.applicationCursorKeys)):p===3?f(p,h.windowOptions.setWinLines?l===80?2:l===132?1:0:0):p===6?f(p,m(r.origin)):p===7?f(p,m(r.wraparound)):p===8?f(p,3):p===9?f(p,m(i==="X10")):p===12?f(p,m(h.cursorBlink)):p===25?f(p,m(!o.isCursorHidden)):p===45?f(p,m(r.reverseWraparound)):p===66?f(p,m(r.applicationKeypad)):p===67?f(p,4):p===1e3?f(p,m(i==="VT200")):p===1002?f(p,m(i==="DRAG")):p===1003?f(p,m(i==="ANY")):p===1004?f(p,m(r.sendFocus)):p===1005?f(p,4):p===1006?f(p,m(s==="SGR")):p===1015?f(p,4):p===1016?f(p,m(s==="SGR_PIXELS")):p===1048?f(p,1):p===47||p===1047||p===1049?f(p,m(c===d)):p===2004?f(p,m(r.bracketedPasteMode)):p===2026?f(p,m(r.synchronizedOutput)):f(p,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Da.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),a=0;do r[1]===5&&(i=1),r[s+a+1+i]=o[a];while(++a<o.length&&a+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Ot.fg,e.bg=Ot.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Ot.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Ot.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Ot.fg&16777215,r.bg&=-67108864,r.bg|=Ot.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${V.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Ot.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!A_(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${V.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>L_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>L_&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(O_(s))if(i==="?")t.push({type:0,index:s});else{let o=P_(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=P_(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);O_(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Wi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(oz[e[0]],Kt[e[1]]||Wi),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Ot.clone(),this._eraseAttrDataInternal=Ot.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new nr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${V.ESC}${o}${V.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},_f=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(M_=e,e=t,t=M_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};_f=Rt([fe(0,xn)],_f);function O_(e){return 0<=e&&e<256}var lz=5e7,z_=12,cz=50,uz=class extends ze{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>lz)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let o=a=>performance.now()-n>=z_?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(n,a);i.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=z_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>cz&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},vf=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let a=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};vf=Rt([fe(0,xn)],vf);var B_=!1,hz=class extends ze{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new to),this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onData=this._register(new te),this.onData=this._onData.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new te),this._instantiationService=new IO,this.optionsService=this._register(new VO(e)),this._instantiationService.setService(kn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(pf)),this._instantiationService.setService(xn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ff)),this._instantiationService.setService(Sx,this._logService),this.coreService=this._register(this._instantiationService.createInstance(mf)),this._instantiationService.setService(fs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(gf)),this._instantiationService.setService(wx,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Gi)),this._instantiationService.setService(DI,this.unicodeService),this._charsetService=this._instantiationService.createInstance(XO),this._instantiationService.setService(TI,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(vf),this._instantiationService.setService(xx,this._oscLinkService),this._inputHandler=this._register(new az(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(sn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(sn.forward(this._bufferService.onResize,this._onResize)),this._register(sn.forward(this.coreService.onData,this._onData)),this._register(sn.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new uz((t,n)=>this._inputHandler.parse(t,n))),this._register(sn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new te),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!B_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),B_=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,t0),t=Math.max(t,n0),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(T_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(T_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=pt(()=>{for(let t of e)t.dispose()})}}},dz={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function fz(e,t,n,r){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=V.ESC+"OA":i.key=V.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=V.ESC+"OD":i.key=V.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=V.ESC+"OC":i.key=V.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=V.ESC+"OB":i.key=V.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":V.DEL,e.altKey&&(i.key=V.ESC+i.key);break;case 9:if(e.shiftKey){i.key=V.ESC+"[Z";break}i.key=V.HT,i.cancel=!0;break;case 13:i.key=e.altKey?V.ESC+V.CR:V.CR,i.cancel=!0;break;case 27:i.key=V.ESC,e.altKey&&(i.key=V.ESC+V.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"D":t?i.key=V.ESC+"OD":i.key=V.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"C":t?i.key=V.ESC+"OC":i.key=V.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"A":t?i.key=V.ESC+"OA":i.key=V.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"B":t?i.key=V.ESC+"OB":i.key=V.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=V.ESC+"[2~");break;case 46:s?i.key=V.ESC+"[3;"+(s+1)+"~":i.key=V.ESC+"[3~";break;case 36:s?i.key=V.ESC+"[1;"+(s+1)+"H":t?i.key=V.ESC+"OH":i.key=V.ESC+"[H";break;case 35:s?i.key=V.ESC+"[1;"+(s+1)+"F":t?i.key=V.ESC+"OF":i.key=V.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=V.ESC+"[5;"+(s+1)+"~":i.key=V.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=V.ESC+"[6;"+(s+1)+"~":i.key=V.ESC+"[6~";break;case 112:s?i.key=V.ESC+"[1;"+(s+1)+"P":i.key=V.ESC+"OP";break;case 113:s?i.key=V.ESC+"[1;"+(s+1)+"Q":i.key=V.ESC+"OQ";break;case 114:s?i.key=V.ESC+"[1;"+(s+1)+"R":i.key=V.ESC+"OR";break;case 115:s?i.key=V.ESC+"[1;"+(s+1)+"S":i.key=V.ESC+"OS";break;case 116:s?i.key=V.ESC+"[15;"+(s+1)+"~":i.key=V.ESC+"[15~";break;case 117:s?i.key=V.ESC+"[17;"+(s+1)+"~":i.key=V.ESC+"[17~";break;case 118:s?i.key=V.ESC+"[18;"+(s+1)+"~":i.key=V.ESC+"[18~";break;case 119:s?i.key=V.ESC+"[19;"+(s+1)+"~":i.key=V.ESC+"[19~";break;case 120:s?i.key=V.ESC+"[20;"+(s+1)+"~":i.key=V.ESC+"[20~";break;case 121:s?i.key=V.ESC+"[21;"+(s+1)+"~":i.key=V.ESC+"[21~";break;case 122:s?i.key=V.ESC+"[23;"+(s+1)+"~":i.key=V.ESC+"[23~";break;case 123:s?i.key=V.ESC+"[24;"+(s+1)+"~":i.key=V.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=V.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=V.DEL:e.keyCode===219?i.key=V.ESC:e.keyCode===220?i.key=V.FS:e.keyCode===221&&(i.key=V.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let a=(o=dz[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)i.key=V.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let l=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(l);e.shiftKey&&(c=c.toUpperCase()),i.key=V.ESC+c}else if(e.keyCode===32)i.key=V.ESC+(e.ctrlKey?V.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let l=e.code.slice(3,4);e.shiftKey||(l=l.toLowerCase()),i.key=V.ESC+l,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=V.US),e.key==="@"&&(i.key=V.NUL));break}return i}var Lt=0,pz=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Cc,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Cc,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Lt=this._search(t),Lt===-1)||this._getKey(this._array[Lt])!==t)return!1;do if(this._array[Lt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Lt),!0;while(++Lt<this._array.length&&this._getKey(this._array[Lt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Lt=this._search(e),!(Lt<0||Lt>=this._array.length)&&this._getKey(this._array[Lt])===e))do yield this._array[Lt];while(++Lt<this._array.length&&this._getKey(this._array[Lt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Lt=this._search(e),!(Lt<0||Lt>=this._array.length)&&this._getKey(this._array[Lt])===e))do t(this._array[Lt]);while(++Lt<this._array.length&&this._getKey(this._array[Lt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},wh=0,F_=0,mz=class extends ze{constructor(){super(),this._decorations=new pz(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new te),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new te),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(pt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new gz(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{wh=i.options.x??0,F_=wh+(i.options.width??1),e>=wh&&e<F_&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},gz=class extends xi{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new te),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new te),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=_t.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=_t.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},yz=1e3,_z=class{constructor(e,t=yz){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},$_=20,Ec=class extends ze{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new _z(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
116
|
+
`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(je(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(pt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<$_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
117
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===$_+1&&(this._liveRegion.textContent+=zd.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],a=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",l=(n.ydisp+i+1).toString(),c=this._rowElements[i];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:l,offset:c})=>{let d=l instanceof Text?l.parentNode:l,h=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let m=c<f.length?f[c]:f.slice(-1)[0]+1;return m>=this._terminal.cols&&(++h,m=0),{row:h,column:m}},s=i(t),o=i(n);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Ec=Rt([fe(1,Qp),fe(2,Xr),fe(3,Jr)],Ec);var bf=class extends ze{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new te),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new te),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(pt(()=>{var s;ls(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(je(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(je(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(je(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(je(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):o.provideLinks(e.y,a=>{var c,d;if(this._isMouseOut)return;let l=a==null?void 0:a.map(h=>({link:h}));(c=this._activeProviderReplies)==null||c.set(s,l),n=this._checkLinkProviderResult(s,e,n),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let s=0;s<i.length;s++){let o=i[s],a=o.link.range.start.y<e?0:o.link.range.start.x,l=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=l;c++){if(n.has(c)){i.splice(s--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&r){let o=r.find(a=>this._linkAtPosition(a.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(l=>this._linkAtPosition(l.link,t));if(a){n=!0,this._handleNewLink(a);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&vz(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ls(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};bf=Rt([fe(1,em),fe(2,Jr),fe(3,xn),fe(4,Cx)],bf);function vz(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var bz=class extends hz{constructor(e={}){super(e),this._linkifier=this._register(new to),this.browser=Ux,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new to),this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new te),this.onKey=this._onKey.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new te),this.onBell=this._onBell.event,this._onFocus=this._register(new te),this._onBlur=this._register(new te),this._onA11yCharEmitter=this._register(new te),this._onA11yTabEmitter=this._register(new te),this._onWillOpen=this._register(new te),this._setup(),this._decorationService=this._instantiationService.createInstance(mz),this._instantiationService.setService(Pa,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(cO),this._instantiationService.setService(Cx,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Fd)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(sn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(sn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(sn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(sn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(pt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=ut.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${V.ESC}]${r};${sz(i)}${Hx.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=zt.toColor(...t.color));else{let s=n;this._themeService.modifyColors(o=>o[s]=zt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ec,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(je(this.element,"copy",t=>{this.hasSelection()&&kI(t,this._selectionService)}));let e=t=>CI(t,this.textarea,this.coreService,this.optionsService);this._register(je(this.textarea,"paste",e)),this._register(je(this.element,"paste",e)),Vx?this._register(je(this.element,"mousedown",t=>{t.button===2&&Jy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(je(this.element,"contextmenu",t=>{Jy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),lm&&this._register(je(this.element,"auxclick",t=>{t.button===1&&gx(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(je(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(je(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(je(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(je(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(je(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(je(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(je(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(je(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Od.get()),Yx||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(aO,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Xr,this._coreBrowserService),this._register(je(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(je(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(lf,this._document,this._helperContainer),this._instantiationService.setService(au,this._charSizeService),this._themeService=this._instantiationService.createInstance(df),this._instantiationService.setService(lo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(xc),this._instantiationService.setService(kx,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(uf,this.rows,this.screenElement)),this._instantiationService.setService(Jr,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(sf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(cf),this._instantiationService.setService(em,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(bf,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(nf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(hf,this.element,this.screenElement,r)),this._instantiationService.setService(LI,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(sn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(rf,this.screenElement)),this._register(je(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ec,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Sc,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Sc,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(af,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var c,d,h,f,m;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let a,l;switch(s.overrideType||s.type){case"mousemove":l=32,s.buttons===void 0?(a=3,s.button!==void 0&&(a=s.button<3?s.button:3)):a=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":l=0,a=s.button<3?s.button:3;break;case"mousedown":l=1,a=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let p=s.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(s,(f=(h=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:h.cell)==null?void 0:f.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return!1;l=p<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(je(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(je(t,"wheel",s=>{var o,a,l,c,d;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(l=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:l.cell)==null?void 0:c.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(s,!0);let h=V.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){mx(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=fz(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===V.ETX||n.key===V.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(wz(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Ot));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(V.ESC+"[I"):this.coreService.triggerDataEvent(V.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function wz(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Sz=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},xz=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new nr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},H_=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new xz(t)}getNullCell(){return new nr}},kz=class extends ze{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new te),this.onBufferChange=this._onBufferChange.event,this._normal=new H_(this._core.buffers.normal,"normal"),this._alternate=new H_(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Cz=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Ez=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Nz=["cols","rows"],br=0,jz=class extends ze{constructor(e){super(),this._core=this._register(new bz(e)),this._addonManager=this._register(new Sz),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(Nz.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Cz(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Ez(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new kz(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
118
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Od.get()},set promptLabel(e){Od.set(e)},get tooMuchOutput(){return zd.get()},set tooMuchOutput(e){zd.set(e)}}}_verifyIntegers(...e){for(br of e)if(br===1/0||isNaN(br)||br%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(br of e)if(br&&(br===1/0||isNaN(br)||br%1!==0||br<0))throw new Error("This API only accepts positive integers")}};/**
|
|
119
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
120
|
+
* @license MIT
|
|
121
|
+
*
|
|
122
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
123
|
+
* @license MIT
|
|
124
|
+
*
|
|
125
|
+
* Originally forked from (with the author's permission):
|
|
126
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
127
|
+
* http://bellard.org/jslinux/
|
|
128
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
129
|
+
*/var Rz=2,Tz=1,Dz=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var h;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((h=this._terminal.options.overviewRuler)==null?void 0:h.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},a=o.top+o.bottom,l=o.right+o.left,c=r-a,d=i-l-t;return{cols:Math.max(Rz,Math.floor(d/e.css.cell.width)),rows:Math.max(Tz,Math.floor(c/e.css.cell.height))}}};function Pz({token:e}){const t=w.useRef(null),[n,r]=w.useState("connecting"),[i,s]=w.useState(null);return w.useEffect(()=>{const o=t.current;if(!o)return;const a=new jz({fontSize:13,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",cursorBlink:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4"}}),l=new Dz;a.loadAddon(l),a.open(o);try{l.fit()}catch{}const c=window.location.protocol==="https:"?"wss":"ws",d=new URL(`${c}://${window.location.host}/ws/pty`);e&&d.searchParams.set("t",e);const h=new WebSocket(d.toString()),f=()=>{h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"resize",cols:a.cols,rows:a.rows}))};h.onopen=()=>{r("open");try{l.fit()}catch{}f(),a.focus()},h.onmessage=y=>{let b;try{b=JSON.parse(y.data)}catch{return}b.type==="data"?a.write(b.data):b.type==="error"?(r("error"),s(b.message||"terminal not available")):b.type==="exit"&&(r("closed"),a.write(`\r
|
|
130
|
+
[session ended${b.code!=null?` (exit ${b.code})`:""}]\r
|
|
131
|
+
`))},h.onclose=()=>r(y=>y==="error"?y:"closed"),h.onerror=()=>{r("error"),s("connection failed")};const m=a.onData(y=>{h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"data",data:y}))});let p;try{p=new ResizeObserver(()=>{try{l.fit(),f()}catch{}}),p.observe(o)}catch{}return()=>{try{p==null||p.disconnect()}catch{}try{m.dispose()}catch{}try{h.close()}catch{}try{a.dispose()}catch{}}},[e]),u.jsxs("div",{className:"terminal-block","data-testid":"terminal-block",children:[n==="error"&&u.jsx("div",{className:"terminal-msg err","data-testid":"terminal-error",children:i||"terminal not available"}),u.jsx("div",{className:"terminal-host",ref:t,"data-testid":"terminal-host"})]})}function Lz({spec:e}){if(!e||!e.kind)return u.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"This block has nothing to show yet."});const{kind:t,note:n,data:r={}}=e;return u.jsxs("div",{className:"cb-block","data-testid":"custom-block","data-kind":t,children:[n&&u.jsx("p",{className:"cb-note",children:n}),t==="metric"&&u.jsx(Az,{data:r}),t==="list"&&u.jsx(Iz,{data:r}),t==="table"&&u.jsx(Mz,{data:r}),t==="markdown"&&u.jsx(Oz,{data:r})]})}function Az({data:e}){const t=["up","down","flat"].includes(e.trend)?e.trend:null;return u.jsxs("div",{className:"cb-metric","data-testid":"custom-metric",children:[u.jsx("div",{className:"cb-metric-value",children:e.value??"—"}),e.label&&u.jsx("div",{className:"cb-metric-label",children:e.label}),e.delta&&u.jsxs("div",{className:`cb-metric-delta ${t?`is-${t}`:""}`,"data-testid":"custom-delta",children:[t==="up"?"▲ ":t==="down"?"▼ ":"",e.delta]}),Array.isArray(e.spark)&&e.spark.length>0&&u.jsx(zz,{values:e.spark})]})}function Iz({data:e}){const t=Array.isArray(e.items)?e.items:[];return t.length?u.jsx("ul",{className:"cb-list","data-testid":"custom-list",children:t.map((n,r)=>u.jsxs("li",{className:"cb-list-row",children:[u.jsx("span",{className:"cb-list-label",children:n.label}),n.value!==void 0&&n.value!==""&&u.jsx("span",{className:"cb-list-value",children:n.value})]},r))}):u.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"Empty list."})}function Mz({data:e}){const t=Array.isArray(e.columns)?e.columns:[],n=Array.isArray(e.rows)?e.rows:[];return n.length?u.jsx("div",{className:"cb-table-wrap",children:u.jsxs("table",{className:"cb-table","data-testid":"custom-table",children:[t.length>0&&u.jsx("thead",{children:u.jsx("tr",{children:t.map((r,i)=>u.jsx("th",{children:r},i))})}),u.jsx("tbody",{children:n.map((r,i)=>u.jsx("tr",{children:(Array.isArray(r)?r:[r]).map((s,o)=>u.jsx("td",{children:s},o))},i))})]})}):u.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"No rows."})}function Oz({data:e}){const t=typeof e.text=="string"?e.text:"";return t?u.jsx("div",{className:"cb-markdown","data-testid":"custom-markdown",children:u.jsx(jS,{text:t})}):u.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"Empty note."})}function zz({values:e}){const t=Math.max(...e,1);return u.jsx("div",{className:"cb-spark","data-testid":"custom-spark","aria-hidden":"true",children:e.map((n,r)=>u.jsx("span",{className:"cb-spark-bar",style:{height:`${8+Math.round(Math.max(0,n)/t*92)}%`}},r))})}function Bz({onClose:e}){const[t,n]=w.useState("viewer"),[r,i]=w.useState(24),[s,o]=w.useState(""),[a,l]=w.useState(null),[c,d]=w.useState([]),[h,f]=w.useState(null),[m,p]=w.useState(!1);w.useEffect(()=>{y()},[]);async function y(){const g=await fetch("/api/share").catch(()=>null);if(!g||!g.ok)return;const S=await g.json();d(S.tokens||[])}async function b(){f(null),p(!0);try{const g=await fetch("/api/share",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({role:t,ttlSeconds:Math.max(60,Number(r)*3600),label:s})}),S=await g.json();if(!g.ok)throw new Error(S.error||`HTTP ${g.status}`);l(S),y()}catch(g){f(g.message||String(g))}finally{p(!1)}}async function _(g){await fetch(`/api/share/${encodeURIComponent(g)}`,{method:"DELETE"}),y()}async function v(g){try{await navigator.clipboard.writeText(g)}catch{}}return u.jsx("div",{className:"modal-backdrop",onClick:e,children:u.jsxs("div",{className:"modal",onClick:g=>g.stopPropagation(),"data-testid":"share-dialog",children:[u.jsx("h2",{children:"Share workspace"}),u.jsx("p",{className:"muted",children:"Issue a token-protected URL. Anyone with the link opens this workspace in their browser with the role you choose."}),u.jsx("label",{children:"Role"}),u.jsx("div",{className:"row",children:u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text)"},children:[u.jsx("input",{type:"radio",name:"role",value:"viewer",checked:t==="viewer",onChange:()=>n("viewer"),"data-testid":"share-role-viewer"}),u.jsx("span",{children:"Viewer — read-only chat + preview"})]})}),u.jsx("div",{className:"row",children:u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text)"},children:[u.jsx("input",{type:"radio",name:"role",value:"client",checked:t==="client",onChange:()=>n("client"),"data-testid":"share-role-client"}),u.jsx("span",{children:"Client — can chat and request changes"})]})}),u.jsxs("div",{className:"row",children:[u.jsxs("div",{children:[u.jsx("label",{children:"Expires in"}),u.jsx("input",{type:"number",min:"1",value:r,onChange:g=>i(g.target.value),style:{width:80,background:"var(--bg)",color:"var(--text)",border:"1px solid var(--border)",padding:"4px 8px",borderRadius:6},"data-testid":"share-ttl"}),u.jsx("span",{style:{marginLeft:6,color:"var(--text-muted)",fontSize:12},children:"hours"})]}),u.jsxs("div",{style:{flex:1},children:[u.jsx("label",{children:"Label (optional)"}),u.jsx("input",{value:s,onChange:g=>o(g.target.value),placeholder:"e.g. Mel preview",style:{width:"100%",background:"var(--bg)",color:"var(--text)",border:"1px solid var(--border)",padding:"4px 8px",borderRadius:6},"data-testid":"share-label"})]})]}),h&&u.jsx("div",{style:{color:"var(--error)",fontSize:12,marginBottom:8},"data-testid":"share-error",children:h}),a&&u.jsxs(u.Fragment,{children:[u.jsx("label",{children:"Share URL"}),u.jsx("div",{className:"url-output","data-testid":"share-url",children:a.shareUrl}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{onClick:()=>v(a.shareUrl),"data-testid":"share-copy",children:"Copy"}),u.jsx("a",{href:a.shareUrl,target:"_blank",rel:"noreferrer",children:u.jsx("button",{children:"Open"})})]})]}),c.length>0&&u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{children:"Active share tokens"}),u.jsx("div",{style:{maxHeight:140,overflow:"auto",border:"1px solid var(--border)",borderRadius:6},children:c.map(g=>u.jsxs("div",{style:{padding:"6px 10px",borderBottom:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12},"data-testid":`active-token-${g.sub}`,children:[u.jsxs("div",{children:[u.jsx("strong",{children:g.label||g.role})," ",u.jsxs("span",{style:{color:"var(--text-muted)"},children:["(",g.role,", expires ",new Date(g.exp*1e3).toLocaleString(),")"]})]}),u.jsx("button",{onClick:()=>_(g.sub),style:{fontSize:11},"data-testid":`revoke-${g.sub}`,children:"Revoke"})]},g.sub))})]}),u.jsxs("div",{className:"actions",children:[u.jsx("button",{onClick:e,"data-testid":"share-close",children:"Close"}),u.jsx("button",{className:"primary",onClick:b,disabled:m,"data-testid":"share-issue",children:m?u.jsx("span",{className:"spinner"}):"Issue URL"})]})]})})}function Fz({onClose:e,token:t}){var F,A;const[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,a]=w.useState(null),[l,c]=w.useState(!1),[d,h]=w.useState(""),[f,m]=w.useState(""),[p,y]=w.useState(168),[b,_]=w.useState(null);w.useEffect(()=>{g()},[]);function v(R,P={}){const N={...P.headers||{}};return t&&(N.Authorization=`Bearer ${t}`),fetch(R,{...P,headers:N})}async function g(){a(null),s(!1);const R=await v("/api/sync/status").catch(()=>null);if(!R||!R.ok){s(!0);return}r(await R.json())}async function S(R){a(null),c(!0);try{await R()}catch(P){a(P.message||String(P))}finally{c(!1)}}const k=()=>S(async()=>{const R=await v("/api/sync/pair",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({inviteCode:d})}),P=await R.json();if(!R.ok)throw new Error(P.error||`HTTP ${R.status}`);h(""),await g()}),x=()=>S(async()=>{var N,O;const R=await v("/api/sync/invite",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectCode:(O=(N=n==null?void 0:n.workspaces)==null?void 0:N[0])==null?void 0:O.projectId,displayName:f,expiresHours:Math.max(1,Number(p)||168)})}),P=await R.json();if(!R.ok)throw new Error(P.error||`HTTP ${R.status}`);_(P.invite)}),T=()=>S(async()=>{var N,O;const R=await v("/api/sync/detach",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({workspaceId:(O=(N=n==null?void 0:n.workspaces)==null?void 0:N[0])==null?void 0:O.workspaceId})}),P=await R.json();if(!R.ok)throw new Error(P.error||`HTTP ${R.status}`);_(null),await g()});async function L(R){try{await navigator.clipboard.writeText(R)}catch{}}const B=((F=n==null?void 0:n.workspaces)==null?void 0:F[0])||null,j=!!n&&!((A=n.daemon)!=null&&A.running);return u.jsx("div",{className:"modal-backdrop",onClick:e,children:u.jsxs("div",{className:"modal",onClick:R=>R.stopPropagation(),"data-testid":"sync-dialog",children:[u.jsx("h2",{children:"Collaborate on this folder"}),u.jsx("p",{className:"muted",children:"bmo-sync keeps this workspace folder identical across machines — yours and a collaborator's. Both of you edit; changes flow both ways. Like a shared drive, but built for workspaces."}),!n&&!i&&u.jsxs("div",{className:"muted",children:[u.jsx("span",{className:"spinner"})," Checking sync status…"]}),i&&u.jsxs("div",{className:"sync-state warn","data-testid":"sync-load-failed",children:[u.jsx("strong",{children:"Couldn't load sync status."}),u.jsx("span",{className:"muted",children:"The workspace server didn't answer. Try again."})]}),j&&u.jsxs("div",{className:"sync-state warn","data-testid":"sync-daemon-down",children:[u.jsx("strong",{children:"The bmo-sync daemon isn't running."}),u.jsx("span",{className:"muted",children:"Folder sharing needs the background sync service running on this machine. Start it, then recheck."})]}),n&&!j&&!B&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"sync-state","data-testid":"sync-unpaired",children:[u.jsxs("strong",{children:[n.workspaceName," isn't shared yet."]}),u.jsx("span",{className:"muted",children:"Got an invite code from a collaborator? Paste it to sync this folder with theirs."})]}),u.jsx("label",{children:"Invite code"}),u.jsxs("div",{className:"row",children:[u.jsx("input",{className:"sync-input",style:{flex:1},value:d,onChange:R=>h(R.target.value),placeholder:"e.g. CAFE-MILANO-A8X3","data-testid":"sync-invite-input"}),u.jsx("button",{className:"primary",onClick:k,disabled:l||!d.trim(),"data-testid":"sync-join",children:l?u.jsx("span",{className:"spinner"}):"Connect folder"})]})]}),n&&!j&&B&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"sync-state ok","data-testid":"sync-paired",children:[u.jsxs("strong",{children:["✓ Synced — ",B.projectName||B.projectId]}),u.jsxs("span",{className:"muted",children:["This folder is shared. Edits sync both ways automatically",B.conflictCount?` · ${B.conflictCount} conflict${B.conflictCount>1?"s":""} resolved`:"","."]})]}),n.canInvite?u.jsxs(u.Fragment,{children:[u.jsx("label",{children:"Invite a collaborator"}),u.jsxs("div",{className:"row",children:[u.jsx("input",{className:"sync-input",style:{flex:1},value:f,onChange:R=>m(R.target.value),placeholder:"Their name — e.g. Mel","data-testid":"sync-invite-name"}),u.jsx("input",{className:"sync-input",style:{width:64},type:"number",min:"1",value:p,onChange:R=>y(R.target.value),title:"Invite expires in (hours)"}),u.jsx("button",{onClick:x,disabled:l,"data-testid":"sync-create-invite",children:l?u.jsx("span",{className:"spinner"}):"Create invite"})]}),b&&u.jsxs(u.Fragment,{children:[u.jsx("label",{children:"Send this code to your collaborator"}),u.jsx("div",{className:"url-output","data-testid":"sync-invite-code",children:b.code}),u.jsxs("div",{className:"row",style:{marginBottom:0},children:[u.jsx("button",{onClick:()=>L(b.code),"data-testid":"sync-copy-code",children:"Copy code"}),b.expiresAt&&u.jsxs("span",{className:"muted",style:{margin:0},children:["expires ",new Date(b.expiresAt*1e3).toLocaleDateString()]})]})]})]}):u.jsxs("p",{className:"muted","data-testid":"sync-no-invite",children:["Inviting from here needs a bmo-sync admin key (set"," ",u.jsx("span",{className:"md-code-inline",children:"BMO_SYNC_ADMIN_KEY"}),"). Without it, anyone you've already invited can still join with their own code."]})]}),o&&u.jsx("div",{style:{color:"var(--error)",fontSize:12,marginTop:8},"data-testid":"sync-error",children:o}),u.jsxs("div",{className:"actions",children:[(j||i)&&u.jsx("button",{onClick:g,disabled:l,"data-testid":"sync-recheck",children:"Recheck"}),B&&!j&&u.jsx("button",{onClick:T,disabled:l,"data-testid":"sync-disconnect",children:"Disconnect"}),u.jsx("button",{onClick:e,"data-testid":"sync-close",children:"Close"})]})]})})}function $z({alert:e,onDismiss:t}){if(!e)return null;const n=e.kind==="fatal";return u.jsxs("div",{className:"conflict-banner","data-testid":"conflict-banner",role:"status",children:[u.jsx("span",{className:"ico",children:n?"⛔":"⚠️"}),n?u.jsxs("span",{children:[u.jsx("strong",{children:"Sync stopped."})," ",e.message||"The sync engine hit a fatal error."," Reconnect from the Collaborate dialog."]}):u.jsxs("span",{children:[u.jsx("strong",{children:"Sync conflict"})," on ",u.jsx("code",{children:e.path||"a file"})," — bmo-sync kept ",u.jsx("strong",{children:e.resolution||"the latest edit"}),e.user?` (also edited by ${e.user})`:"","."]}),u.jsx("span",{className:"spacer"}),u.jsx("button",{onClick:t,"data-testid":"conflict-dismiss",children:"Dismiss"})]})}function Hz({urlToken:e,onClose:t}){const[n,r]=w.useState([]),[i,s]=w.useState(!0),[o,a]=w.useState(null),[l,c]=w.useState(null),[d,h]=w.useState({}),[f,m]=w.useState(null),p=e?{Authorization:`Bearer ${e}`}:{};function y(){s(!0),fetch("/api/conflicts",{headers:p}).then(g=>g.ok?g.json():{conflicts:[]}).then(g=>{r(Array.isArray(g==null?void 0:g.conflicts)?g.conflicts:[]),a(null)}).catch(g=>a(String((g==null?void 0:g.message)||g))).finally(()=>s(!1))}w.useEffect(y,[]);function b(g){return`${g.workspaceId}:${g.path}`}async function _(g){const S=b(g);if(d[S])return;const k=new URL("/api/conflicts/view",window.location.origin);k.searchParams.set("workspaceId",g.workspaceId),k.searchParams.set("path",g.path);const x=await fetch(k.toString(),{headers:p});if(!x.ok){a(`Could not load ${g.path} (HTTP ${x.status})`);return}const T=await x.json().catch(()=>null);T&&h(L=>({...L,[S]:{mine:W_(T.mine),theirs:W_(T.theirs),conflict:T.conflict}}))}async function v(g,S){const k=b(g);m(k);try{const x=await fetch("/api/conflicts/resolve",{method:"POST",headers:{"content-type":"application/json",...p},body:JSON.stringify({workspaceId:g.workspaceId,path:g.path,action:S})});if(!x.ok){const T=await x.json().catch(()=>({}));a((T==null?void 0:T.error)||`Resolve failed (HTTP ${x.status}).`);return}y(),c(null)}finally{m(null)}}return u.jsxs("div",{className:"conflict-panel","data-testid":"conflict-panel",role:"dialog","aria-label":"Open conflicts",children:[u.jsxs("header",{className:"conflict-panel-header",children:[u.jsx("strong",{children:"Open conflicts"})," ",u.jsxs("span",{className:"muted",children:["(",n.length,") · changes saved to the daemon back-office until you resolve"]}),u.jsx("span",{className:"spacer"}),u.jsx("button",{onClick:y,children:"Refresh"}),u.jsx("button",{onClick:t,children:"Close"})]}),i&&u.jsx("div",{className:"muted",children:"Loading…"}),o&&u.jsx("div",{className:"conflict-panel-error",children:o}),!i&&n.length===0&&u.jsx("div",{className:"muted",children:"No open conflicts."}),u.jsx("ul",{className:"conflict-list",children:n.map(g=>{const S=b(g),k=l===S,x=d[S];return u.jsxs("li",{className:"conflict-row",children:[u.jsxs("div",{className:"conflict-row-head",onClick:()=>{k?c(null):(c(S),g.resolution!=="remote_announced"&&_(g))},children:[u.jsx("code",{children:g.path}),u.jsxs("span",{className:"muted",children:["·"," ",g.resolution==="remote_announced"?`${g.conflictingUser||"peer"} flagged`:g.conflictingUser||"peer"," ","·"," ",new Date((g.detectedAt||0)*1e3).toLocaleTimeString()]}),u.jsx("span",{className:"spacer"}),u.jsx("span",{className:"muted",children:k?"▲":"▼"})]}),k&&g.resolution==="remote_announced"&&u.jsxs("div",{className:"conflict-row-body",children:[u.jsxs("div",{className:"muted",children:[g.conflictingUser||"A peer"," reported a conflict on this file. Your local copy is unchanged here — open it, decide whether to keep your version or pull theirs, save, and the next sync will reconcile."]}),u.jsx("div",{className:"conflict-actions",children:u.jsx("button",{disabled:f===S,onClick:()=>v(g,"keep_mine"),"data-testid":"conflict-acknowledge",children:"Acknowledge"})})]}),k&&g.resolution!=="remote_announced"&&u.jsxs("div",{className:"conflict-row-body",children:[!x&&u.jsx("div",{className:"muted",children:"Loading diff…"}),x&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"conflict-meta",children:[u.jsxs("span",{children:["mine: ",u.jsx("code",{children:Sh(g.mineSha256)})]}),u.jsxs("span",{children:["theirs: ",u.jsx("code",{children:Sh(g.theirsSha256)})]}),g.baseSha256&&u.jsxs("span",{children:["base: ",u.jsx("code",{children:Sh(g.baseSha256)})]})]}),u.jsx(Wz,{mine:x.mine,theirs:x.theirs}),u.jsxs("div",{className:"conflict-actions",children:[u.jsx("button",{disabled:f===S,onClick:()=>v(g,"keep_mine"),"data-testid":"conflict-keep-mine",children:"Keep mine"}),u.jsx("button",{disabled:f===S,onClick:()=>v(g,"take_theirs"),"data-testid":"conflict-take-theirs",children:"Take theirs"})]})]})]})]},S)})})]})}function W_(e){if(typeof e!="string")return null;try{const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new TextDecoder().decode(n)}catch{return null}}function Sh(e){return typeof e!="string"?"∅":e.length>12?`${e.slice(0,12)}…`:e}function Wz({mine:e,theirs:t}){return e==null&&t==null?u.jsx("div",{className:"muted",children:"Both versions unavailable on disk."}):e==null||t==null?u.jsx("div",{className:"muted",children:"Only one side is available — the other was deleted before resolution."}):u.jsx(Pl,{oldText:t,newText:e})}function Uz({role:e,urlToken:t,onSyncAlert:n,onOpenConflicts:r}){const[i,s]=w.useState([]),[o,a]=w.useState({tokensIn:0,tokensOut:0,costUsd:0}),[l,c]=w.useState([]),[d,h]=w.useState(!1),[f,m]=w.useState(null),[p,y]=w.useState(0);w.useEffect(()=>{if(e!=="partner")return;const S=t?{Authorization:`Bearer ${t}`}:{};fetch("/api/sync/status",{headers:S}).then(k=>k.ok?k.json():null).then(k=>{var x;k&&m({paired:!!k.paired,daemonRunning:!!((x=k.daemon)!=null&&x.running),peer:null})}).catch(()=>{}),fetch("/api/conflicts",{headers:S}).then(k=>k.ok?k.json():{conflicts:[]}).then(k=>y(Array.isArray(k==null?void 0:k.conflicts)?k.conflicts.length:0)).catch(()=>{})},[e,t]),w.useEffect(()=>{const S=window.location.protocol==="https:"?"wss":"ws",k=new URL(`${S}://${window.location.host}/ws/activity`);t&&k.searchParams.set("t",t);const x=new WebSocket(k.toString());return x.onopen=()=>h(!0),x.onclose=()=>h(!1),x.onmessage=T=>{let L;try{L=JSON.parse(T.data)}catch{return}L.type==="snapshot"?(s(L.snapshot.presence||[]),a(L.snapshot.usage||{tokensIn:0,tokensOut:0,costUsd:0}),c(L.snapshot.recent||[])):(c(B=>[...B.slice(-49),L]),b(L))},()=>{try{x.close()}catch{}}},[t]);function b(S){S.type==="daemon-status"?m(k=>({...k||{paired:!1},daemonRunning:!!S.connected})):S.type==="sync-paired"?m(k=>({...k||{},paired:!0,daemonRunning:!0})):S.type==="sync-detached"?m(k=>({...k||{},paired:!1,peer:null})):S.type==="remote-presence"?m(k=>({...k||{paired:!0},peer:S.user||null})):S.type==="sync-conflict"?(n==null||n({kind:"conflict",path:S.path,resolution:S.resolution,user:S.conflictingUser}),(S.resolution==="local_pre_write_guard"||S.resolution==="remote_announced")&&y(k=>k+1)):S.type==="sync-conflict-resolved"?y(k=>Math.max(0,k-1)):S.type==="sync-fatal"&&(n==null||n({kind:"fatal",message:S.message}))}const _=[...l].reverse().find(S=>S.type==="chat-stream"||S.type==="chat-user"||S.type==="chat-end"),v=l.find(S=>S.type==="inbox-change");let g=null;return f!=null&&f.paired&&(g=f.daemonRunning?u.jsxs("span",{className:"pill synced","data-testid":"activity-sync",children:["⇄ Synced",f.peer?` · with ${f.peer}`:""]}):u.jsx("span",{className:"pill sync-off","data-testid":"activity-sync",children:"⇄ Sync paused"})),u.jsxs("footer",{className:"bottombar","data-testid":"activity-bar",children:[u.jsx("span",{className:`pill ${d?"live":""}`,"data-testid":"activity-connected",children:d?"live":"reconnecting…"}),u.jsxs("span",{className:"pill","data-testid":"activity-presence",children:["👥 ",i.length," viewing"]}),g,e==="partner"&&p>0&&u.jsxs("button",{type:"button",className:"pill conflict-badge","data-testid":"activity-conflicts",onClick:()=>r==null?void 0:r(),title:"Resolve open sync conflicts",children:["🛑 ",p," conflict",p===1?"":"s"]}),u.jsxs("span",{className:"pill","data-testid":"activity-usage",children:["↓",o.tokensIn," ↑",o.tokensOut," · $",(o.costUsd||0).toFixed(3)]}),_&&u.jsx("span",{className:"pill",style:{maxWidth:380,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"data-testid":"activity-last",children:_.type==="chat-end"?"✓ agent finished":"… agent streaming"}),v&&u.jsx("span",{className:"pill","data-testid":"activity-inbox",children:"📦 inbox updated"}),u.jsx("span",{style:{flex:1}}),u.jsxs("span",{style:{fontSize:11},children:["v0.1.0 · ",e]})]})}function Vz(){var r;const[e,t]=w.useState(null);if(w.useEffect(()=>{let i=!1;async function s(){try{const l=await(await fetch("/api/inbox")).json();i||t(l)}catch{}}s();const o=setInterval(s,5e3);return()=>{i=!0,clearInterval(o)}},[]),!e||!e.hasInbox||!((r=e.imports)!=null&&r.length))return null;const n=e.imports.filter(i=>{var o;const s=Object.keys(e.installed||{}).find(a=>a.startsWith(i.replace(/-v[\d.]+$/,"")));return s?((o=e.installed[s])==null?void 0:o.integrated)!==!0:!0});return n.length===0?null:u.jsxs("div",{className:"inbox-card","data-testid":"inbox-card",children:["📦 ",u.jsx("strong",{children:"Component inbox"}),": ",n.length," pending integration",n.length!==1?"s":"",": ",n.join(", "),".",u.jsxs("span",{className:"muted",children:["Ask the agent: ",u.jsxs("em",{children:["“walk me through integrating ",n[0],"”"]})]})]})}function U_(e){return`${Math.round((Number(e)||0)*100)}%`}function V_(e){return`$${(Number(e)||0).toFixed(2)}`}function q_(e){const t=Math.max(0,Math.min(5,Math.round(Number(e)||0)));return"★★★★★".slice(0,t)+"☆☆☆☆☆".slice(0,5-t)}function yl(e){var t,n;return((t=e.producer)==null?void 0:t.handle)==="you"||((n=e.producer)==null?void 0:n.kind)==="me"}function qz(e){const t=`${e.title} ${(e.tags||[]).join(" ")} ${e.pitch||""}`.toLowerCase(),n=[[/match|candidate|recruit|\bhir|screen|talent/,"🎯"],[/\bcv\b|resume|parse|extract/,"📄"],[/kanban|board|pipeline|stage|drag/,"🗂️"],[/deploy|cloudflare|worker|\bhost|ship|edge|serverless/,"🚀"],[/landing|waitlist|subscription|launch|checkout/,"🌱"],[/portfolio|personal site/,"🖼️"],[/receipt|expense|invoice|account/,"🧾"],[/feedback|survey|\bform\b/,"💬"],[/book|slot|appointment|schedul|calendar/,"📅"]];for(const[r,i]of n)if(r.test(t))return i;return"🧩"}function K_(e){var n,r,i,s;const t=(((n=e.reward)==null?void 0:n.unit)||"").toLowerCase();return e.hasService||((r=e.reward)==null?void 0:r.model)==="recurring"||/match|use/.test(t)?"earns per use":((i=e.reward)==null?void 0:i.model)==="one-time"?"one-time reward":(s=e.reward)!=null&&s.model?`${e.reward.model} reward`:null}function Kz(e,t){var n;return t?`I want to build "${e.title}" from my own recipe.`:`I want to build "${e.title}". Use ${((n=e.producer)==null?void 0:n.name)||"the producer"}'s recipe.`}function Yz({theme:e}){const t=(e==null?void 0:e.tokens)||{},n=`radial-gradient(120% 80% at 15% 0%, ${t.canvas1||"#e8f7f0"}, transparent 60%),radial-gradient(120% 90% at 100% 0%, ${t.canvas2||"#e7f0fb"}, transparent 55%),linear-gradient(160deg, ${t.canvas3||"#fef8ee"}, ${t.bg||"#ffffff"} 75%)`;return u.jsxs("div",{className:"bz-theme-swatch",style:{background:n},"aria-hidden":!0,children:[u.jsxs("span",{className:"bz-theme-card",style:{background:t.surface||"#fff",borderColor:t.border||"#e2e6ee"},children:[u.jsx("span",{className:"bz-theme-line",style:{background:t.text||"#1d2430"}}),u.jsx("span",{className:"bz-theme-line short",style:{background:t.textMuted||"#687083"}})]}),u.jsx("span",{className:"bz-theme-dot",style:{background:(e==null?void 0:e.accent)||"#0891b2"}})]})}function Gz({onClose:e,onBuild:t,onApplyTheme:n,onRemixTheme:r,token:i}){const[s,o]=w.useState([]),[a,l]=w.useState(null),[c,d]=w.useState(null),[h,f]=w.useState(!0),[m,p]=w.useState(null),[y,b]=w.useState(null),[_,v]=w.useState(null),[g,S]=w.useState({});async function k(N){if(!g[N.id]){S(O=>({...O,[N.id]:!0}));try{const O={"content-type":"application/json",...i?{Authorization:`Bearer ${i}`}:{}};await fetch(`/api/bazaar/themes/${encodeURIComponent(N.id)}/report`,{method:"POST",headers:O,body:JSON.stringify({reason:""})})}catch{}}}async function x(N){if(!(!n||_)){v(N.id);try{const O=i?{Authorization:`Bearer ${i}`}:{},W=await fetch(`/api/bazaar/themes/${encodeURIComponent(N.id)}/apply`,{method:"POST",headers:O}),D=W.ok?await W.json():null,I=(D==null?void 0:D.theme)||N.theme;I?(n(I),e==null||e()):p("Could not apply that theme.")}catch(O){p(String(O.message||O))}finally{v(null)}}}w.useEffect(()=>{let N=!1;async function O(){try{const[W,D]=await Promise.all([fetch("/api/bazaar/shelf"),fetch("/api/bazaar/state")]);if(N)return;const I=await W.json(),C=await D.json();if(N)return;const X=(I.recipes||[]).slice().sort((ie,E)=>(E.outcomeScore||0)-(ie.outcomeScore||0));o(X),d(I.network||null),l(C)}catch(W){N||p(String(W.message||W))}finally{N||f(!1)}}return O(),()=>{N=!0}},[]);const T=c?c.capable?c.lastSyncOk===!1?{tone:"offline",text:"Community looks are offline right now — showing the seeds and your own."}:c.poolCount===0&&c.lastSyncOk==null?{tone:"info",text:"Checking for community looks…"}:c.poolCount===0?{tone:"empty",text:"No community looks yet — publish one and you'll be the first."}:{tone:"live",text:`${c.poolCount} ${c.poolCount===1?"look":"looks"} from the community.`}:{tone:"info",text:"Sign in to discover and share looks across VentureWild."}:null,L=((a==null?void 0:a.earnings)||[]).filter(N=>N.total>0),B=s.filter(N=>N.kind==="theme"),j=B.filter(yl),F=s.filter(N=>N.kind!=="theme"),A=F.filter(yl),R=L.find(N=>N.handle==="you"),P=new Set(s.map(N=>{var O,W;return((O=N.producer)==null?void 0:O.handle)||((W=N.producer)==null?void 0:W.name)||"?"})).size;return u.jsx("div",{className:"modal-backdrop",onClick:e,children:u.jsxs("div",{className:"modal bazaar-modal",onClick:N=>N.stopPropagation(),"data-testid":"bazaar-shelf",children:[u.jsxs("div",{className:"bz-store-head",children:[u.jsxs("div",{className:"bz-store-headings",children:[u.jsx("h2",{children:"🛍️ The bazaar"}),u.jsx("p",{className:"muted bz-store-sub",children:"Proven recipes from a network of producers. Your agent reaches onto this shelf for you — ranked by how often each one actually gets a working result, not by marketing."})]}),u.jsxs("div",{className:"bz-store-stats","data-testid":"bazaar-store-stats",children:[u.jsxs("span",{className:"bz-stat",children:[u.jsx("strong",{children:F.length}),"recipes"]}),B.length>0&&u.jsxs("span",{className:"bz-stat",children:[u.jsx("strong",{children:B.length}),"themes"]}),u.jsxs("span",{className:"bz-stat",children:[u.jsx("strong",{children:P}),"producers"]})]})]}),m&&u.jsx("div",{className:"bz-err",children:m}),h&&s.length===0&&u.jsx("div",{className:"muted bz-loading","data-testid":"bazaar-loading",children:"Loading the shelf…"}),A.length>0&&u.jsxs("div",{className:"bz-you-banner","data-testid":"bazaar-you-banner",children:[u.jsx("span",{className:"bz-you-spark",children:"✦"}),u.jsxs("span",{children:["You're a producer here — ",u.jsx("strong",{children:A.length})," ",A.length===1?"of your recipes is":"of your recipes are"," on the shelf",R&&u.jsxs(u.Fragment,{children:[" · earning ",u.jsx("strong",{children:V_(R.total)}),u.jsx("span",{className:"bz-represented",children:" represented"})]})]})]}),B.length>0&&u.jsxs("div",{className:"bz-theme-section","data-testid":"bazaar-themes",children:[u.jsxs("div",{className:"bz-theme-section-head",children:[u.jsx("span",{className:"gallery-section",children:"🎨 themes — make your workspace yours"}),u.jsx("span",{className:"muted bz-theme-section-sub",children:"Pure colour, applies in one tap. The maker earns when you wear it."}),T&&u.jsx("span",{className:`bz-net-note bz-net-${T.tone}`,"data-testid":"bazaar-network-note",children:T.text}),j.length>0&&u.jsx("span",{className:"bz-earn-honesty muted","data-testid":"bazaar-earn-honesty",children:"Your apply counts are tracked on this device — cross-user applies aren't tallied yet."})]}),u.jsx("div",{className:"bz-theme-grid",children:B.map(N=>{var W,D,I;const O=yl(N);return u.jsxs("div",{className:`bz-theme-card-wrap${O?" mine":""}`,"data-testid":`shelf-theme-${N.id}`,children:[u.jsx(Yz,{theme:N.theme}),u.jsxs("div",{className:"bz-theme-meta",children:[u.jsx("span",{className:"bz-theme-title",children:N.title}),u.jsxs("span",{className:"bz-theme-by",children:["by ",((W=N.producer)==null?void 0:W.name)||"a maker",O&&" (you)"]}),N.pitch&&u.jsx("span",{className:"bz-theme-pitch",children:N.pitch}),u.jsxs("div",{className:"bz-theme-foot",children:[((D=N.rating)==null?void 0:D.count)>0&&u.jsx("span",{className:"bz-theme-rating",children:q_(N.rating.stars)}),u.jsxs("span",{className:"bz-reward-pill",children:[V_((I=N.reward)==null?void 0:I.oneTimeValue)," · per apply"]})]})]}),u.jsxs("div",{className:"bz-theme-actions",children:[u.jsx("button",{type:"button",className:"bz-theme-apply","data-testid":`shelf-apply-theme-${N.id}`,disabled:_===N.id,onClick:()=>x(N),children:_===N.id?"Applying…":"Apply"}),r&&N.theme&&u.jsx("button",{type:"button",className:"bz-theme-remix","data-testid":`shelf-remix-theme-${N.id}`,title:"Load this look into the Theme picker to tweak + republish as your own",onClick:()=>{r(N),e==null||e()},children:"✦ Remix"}),N.source==="rails"&&!O&&u.jsx("button",{type:"button",className:"bz-theme-report","data-testid":`shelf-report-theme-${N.id}`,disabled:!!g[N.id],title:"Report this look to VentureWild",onClick:()=>k(N),children:g[N.id]?"Reported ✓":"⚐ Report"})]}),_y(N)&&u.jsxs("span",{className:"bz-theme-lineage","data-testid":`shelf-theme-lineage-${N.id}`,children:["remixed from ",_y(N)]})]},N.id)})})]}),u.jsx("div",{className:"bz-shelf-grid","data-testid":"bazaar-shelf-grid",children:F.map(N=>{var C,X,ie,E,ue,ve;const O=yl(N),W=((C=N.outcomeStats)==null?void 0:C.builds)||0,D=W===0||N.safetyBadge==="new",I=y===N.id;return u.jsxs("div",{className:`bz-card${O?" mine":""}${I?" open":""}`,"data-testid":`shelf-recipe-${N.id}`,onClick:()=>b(I?null:N.id),children:[u.jsxs("div",{className:"bz-card-head",children:[u.jsx("span",{className:"bz-card-glyph","aria-hidden":!0,children:qz(N)}),u.jsxs("div",{className:"bz-card-titles",children:[u.jsx("span",{className:"bz-card-title",children:N.title}),u.jsxs("span",{className:"bz-card-by",children:["by ",((X=N.producer)==null?void 0:X.name)||"a producer",u.jsx("span",{className:`bz-kind bz-kind-${O?"you":((ie=N.producer)==null?void 0:ie.kind)||"maker"}`,children:O?"you":((E=N.producer)==null?void 0:E.kind)==="vendor"?"vendor":"maker"}),N.hasService&&u.jsx("span",{className:"bz-kind bz-kind-tool",children:"tool"})]})]}),u.jsx("div",{className:"bz-card-score",children:D?u.jsx("span",{className:"bz-new",title:"Just listed — earns its rank by working",children:"NEW"}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"bz-score-pct",children:U_(N.outcomeScore)}),u.jsx("span",{className:"bz-score-label",children:"works"})]})})]}),!D&&u.jsx("div",{className:"bz-score-bar",title:"Measured: how often this recipe reaches a working result",children:u.jsx("i",{style:{width:U_(N.outcomeScore)}})}),N.pitch&&u.jsx("p",{className:"bz-card-pitch",children:N.pitch}),u.jsxs("div",{className:"bz-card-foot",children:[(()=>{const Z=RS(N);return Z.label!=="New"?u.jsx("span",{className:`bz-badge bz-trust-${Z.tone}`,"data-testid":`shelf-trust-${N.id}`,title:Z.note||void 0,children:Z.label}):null})(),((ue=N.rating)==null?void 0:ue.count)>0&&u.jsxs("span",{className:"bz-card-rating",title:`${N.rating.stars} from ${N.rating.count}`,children:[q_(N.rating.stars)," ",u.jsxs("span",{className:"muted",children:["(",N.rating.count,")"]})]}),K_(N)&&u.jsx("span",{className:"bz-reward-pill",children:K_(N)}),u.jsx("span",{className:"bz-card-expand",children:I?"▾":"▸"})]}),I&&u.jsxs("div",{className:"bz-card-detail","data-testid":`shelf-detail-${N.id}`,children:[N.summary&&u.jsx("p",{className:"bz-detail-summary",children:N.summary}),!D&&W>0&&u.jsxs("p",{className:"muted bz-detail-stat",children:[N.outcomeStats.working," of ",W," builds reached a working result."]}),u.jsxs("p",{className:"bz-detail-hint",children:["Your agent builds this for you and credits"," ",O?"you":((ve=N.producer)==null?void 0:ve.name)||"the producer"," when it does."]}),t&&u.jsx("button",{type:"button",className:"bz-build-btn","data-testid":`shelf-build-${N.id}`,onClick:Z=>{Z.stopPropagation(),t(Kz(N,O))},children:"Build this →"}),N.source==="rails"&&!O&&u.jsx("button",{type:"button",className:"bz-theme-report","data-testid":`shelf-report-recipe-${N.id}`,disabled:!!g[N.id],title:"Report this recipe to VentureWild",onClick:Z=>{Z.stopPropagation(),k(N)},children:g[N.id]?"Reported ✓":"⚐ Report"})]})]},N.id)})}),u.jsx("div",{className:"actions",children:u.jsx("button",{onClick:e,"data-testid":"bazaar-shelf-close",children:"Close"})})]})})}const Xz=[{id:"concise",label:"Concise",sample:"Got it. Done."},{id:"playful",label:"Playful",sample:"Oh nice — let's go!"},{id:"formal",label:"Formal",sample:"Understood. Proceeding now."},{id:"dry",label:"Dry",sample:"Sure. If we must."}],Y_=["#22d3ee","#a78bfa","#f472b6","#facc15","#34d399","#fb7185"],Jz=[{id:"drive",label:"Google Drive",note:"Files & docs"},{id:"notion",label:"Notion",note:"Wiki & notes"},{id:"gmail",label:"Gmail",note:"Inbox & threads"},{id:"calendar",label:"Calendar",note:"Schedule"},{id:"canva",label:"Canva",note:"Designs"},{id:"github",label:"GitHub",note:"Code & PRs"}],Zz=new Set(["login","missing","subscribe"]),Qz=new Set(["login","missing"]),G_={missing:{title:"Almost there — I need Claude installed before I can think.",subtitle:"That's the brain I run on. Install it once, then come back here.",cmdLabel:"Run this in your terminal",cmd:"curl -fsSL https://claude.ai/install.sh | bash",after:"Then come back and press the button below.",retry:"Still don't see Claude on this machine. Make sure the install finished, then try again."},login:{title:"One quick thing before we dig in — sign me in to Claude.",subtitle:"It's a one-time sign-in to your own Claude account — it runs on your machine, on your plan. After this you won't be asked again.",cmdLabel:"Run this once in your terminal",cmd:"claude auth login",after:"A browser window opens — sign in with your Claude account, then come back and press the button.",retry:"Hmm — still not signed in. Finish the sign-in in your browser, then press it again."},subscribe:{title:"You're in — I just need an active Claude plan to start thinking.",subtitle:"Claude Code runs on a Claude Pro plan (or higher). Grab one on your own account, then come back — you won’t be asked again.",cmdLabel:"Get a plan, then come back",link:"https://claude.ai/upgrade",linkLabel:"Open claude.ai →",after:"Subscribe at claude.ai, then come back and press the button.",retry:"Still no active plan showing. Give it a moment after subscribing, then try again."}},eB=new Set(["md","txt","json","yml","yaml","toml","js","mjs","cjs","ts","tsx","jsx","py","rb","go","rs","java","kt","swift","c","h","cpp","cc","hpp","css","scss","html","sh","env","sql","xml","svg","csv"]);function tB(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}function nB(e){if(!e)return null;try{const t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"?null:t.protocol==="http:"&&(t.port===""||t.port==="80")||t.protocol==="https:"&&(t.port===""||t.port==="443")?t.hostname:`${t.hostname}:${t.port}`}catch{return null}}async function rB(e){const t=Array.from(e||[]).slice(0,200);if(t.length===0)return{folderName:null,files:[]};const n=(t[0].webkitRelativePath||t[0].name).split("/")[0]||"folder",r=40,i=600,s=[];for(const a of t){if(s.length>=r)break;const l=a.webkitRelativePath||a.name,c=tB(a.name);if(!eB.has(c)){s.push({path:l,head:""});continue}if(a.size>100*1024){s.push({path:l,head:""});continue}try{const f=await a.slice(0,i).text();s.push({path:l,head:f})}catch{s.push({path:l,head:""})}}const o=Math.max(t.length-s.length,0);return{folderName:n,files:s,totalFiles:t.length,untouched:o}}function iB({peekSummary:e,services:t,agentName:n}){const r=[],i=e!=null&&e.folderName?` (you just glanced at "${e.folderName}")`:"";return r.push({kind:"survey",title:"Tell me what's in my workspace",sub:e!=null&&e.folderName?"I'll read the workspace I'm running in and summarize.":"I'll read what's here and summarize the project."}),(t==null?void 0:t.size)>0?r.push({kind:"startup",title:"Help me start something new",sub:`${n} will ask one question to figure out what to build.`}):r.push({kind:"startup",title:"Help me start a project",sub:"Tell me the rough idea — I'll scaffold it."}),r.push({kind:"chat",title:"Just chat — find me work",sub:"No agenda yet. Get me into the workspace."}),r}function X_(e,t=55,n=380){const[r,i]=w.useState(""),[s,o]=w.useState(!1),[a,l]=w.useState(!1);return w.useEffect(()=>{if(!e){i(""),o(!1),l(!1);return}i(""),o(!1),l(!1);let c=0,d=null;const h=setTimeout(()=>{l(!0),d=setInterval(()=>{c+=1,i(e.slice(0,c)),c>=e.length&&(clearInterval(d),o(!0))},t)},n);return()=>{clearTimeout(h),d&&clearInterval(d)}},[e,t,n]),[r,s,a]}function oi({children:e,from:t="agent",accent:n,streaming:r=!1}){return u.jsx("div",{className:`ob-bubble ob-bubble-${t}${r?" ob-bubble-streaming":""}`,style:t==="user"?{borderColor:n}:void 0,children:e})}function bs(){return u.jsx("span",{className:"ob-caret","aria-hidden":"true",children:"▍"})}function J_(e){const t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}-${t}`}function sB({session:e,token:t,onComplete:n}){var dt,kt,Ct,Et;const[r,i]=w.useState(1),s=w.useMemo(()=>nB(e==null?void 0:e.shareBaseUrl),[e==null?void 0:e.shareBaseUrl]),[o,a]=w.useState(((dt=e==null?void 0:e.identity)==null?void 0:dt.name)||""),[l,c]=w.useState(((kt=e==null?void 0:e.identity)==null?void 0:kt.tone)||"concise"),[d,h]=w.useState(((Ct=e==null?void 0:e.identity)==null?void 0:Ct.color)||Y_[0]),[f,m]=w.useState(!1),[p,y]=w.useState(null),[b,_]=w.useState(null),[v,g]=w.useState(!1),[S,k]=w.useState(!1),[x,T]=w.useState(null),[L,B]=w.useState(""),[j,F]=w.useState(new Set(((Et=e==null?void 0:e.identity)==null?void 0:Et.connectedServices)||[])),[A,R]=w.useState(!1),[P,N]=w.useState(null),[O,W]=w.useState(null),[D,I]=w.useState(!1),C=w.useRef(null),X=w.useRef(null),ie=w.useRef({}),[E,ue]=w.useState({}),ve=w.useCallback((H,le,he)=>{H&&ue(Ce=>{const ne=Ce[H]||{text:"",done:!1,error:null},Se=le==="text"?ne.text+(he||""):ne.text,de={...Ce,[H]:{...ne,text:Se}};return ie.current[H]=Se,de})},[]),Z=w.useCallback((H,le)=>{H&&ue(he=>{const Ce=he[H]||{text:"",done:!1,error:null};return{...he,[H]:{...Ce,done:!0,error:le||Ce.error}}})},[]);w.useEffect(()=>{let H=!1,le=0,he=null,Ce=null;const ne=()=>{if(H)return;const Se=window.location.protocol==="https:"?"wss":"ws",de=new URL(`${Se}://${window.location.host}/ws/chat`);t&&de.searchParams.set("t",t),Ce=new WebSocket(de.toString()),X.current=Ce,Ce.onmessage=Te=>{var De;let Ne;try{Ne=JSON.parse(Te.data)}catch{return}Ne.type==="chunk"&&((De=Ne.chunk)==null?void 0:De.type)==="text"?ve(Ne.messageId,"text",Ne.chunk.text):Ne.type==="end"?Z(Ne.messageId,null):Ne.type==="error"&&Z(Ne.messageId,Ne.message||"agent error")},Ce.onopen=()=>{le=0},Ce.onclose=()=>{if(X.current=null,H)return;const Te=Math.min(1e3*2**le,8e3);le+=1,he=setTimeout(ne,Te)},Ce.onerror=()=>{}};return ne(),()=>{H=!0,clearTimeout(he);try{Ce==null||Ce.close()}catch{}}},[t,ve,Z]),w.useEffect(()=>{document.documentElement.style.setProperty("--accent",d),document.documentElement.style.setProperty("--accent-hot",d)},[d]);const pe=w.useMemo(()=>{const H={"content-type":"application/json"};return t&&(H.Authorization=`Bearer ${t}`),H},[t]);async function ce(H){const le=await fetch("/api/agent/identity",{method:"POST",headers:pe,body:JSON.stringify({name:o,tone:l,color:d,...H})});if(!le.ok){const he=await le.json().catch(()=>({}));throw new Error(he.error||`save failed (${le.status})`)}return le.json()}const ge=w.useCallback(async(H=!1)=>{g(!0);try{const le=await fetch(`/api/agent/readiness${H?"?fresh=1":""}`,{headers:pe});return le.ok?await le.json():{status:"unknown"}}catch{return{status:"unknown"}}finally{g(!1)}},[pe]);async function Pe(){if(y(null),!o.trim()){y("Pick a name — even just one syllable.");return}m(!0);try{await ce({});const H=await ge(!1);if(Zz.has(H.status)){_(H);return}i(2)}catch(H){y(String(H.message||H))}finally{m(!1)}}async function we(){const H=await ge(!0);if(k(!0),H.status==="login"||H.status==="missing"){_(H);return}_(null),i(2)}async function Be(){const H=await ge(!0);if(H.status==="ready"||H.status==="unknown"){T(null),_(null),i(2);return}T(null),_(H)}async function be(){k(!1),T({status:"starting",url:null,error:null});try{const le=await(await fetch("/api/agent/login/start",{method:"POST",headers:pe})).json();T(le),le.status==="success"&&Be()}catch{T({status:"error",url:null,error:"Could not start sign-in."})}}async function Ue(){const H=L.trim();if(H){B("");try{const le=await fetch("/api/agent/login/code",{method:"POST",headers:{...pe,"content-type":"application/json"},body:JSON.stringify({code:H})});T(await le.json())}catch{}}}w.useEffect(()=>{if(!(x&&["starting","awaiting-browser","awaiting-code"].includes(x.status)))return;let le=!0;const he=setInterval(async()=>{try{const ne=await(await fetch("/api/agent/login/status",{headers:pe})).json();if(!le)return;T(ne),ne.status==="success"&&(clearInterval(he),Be())}catch{}},2e3);return()=>{le=!1,clearInterval(he)}},[x==null?void 0:x.status,pe]);const[M,ae]=w.useState(null),re=M?E[M]:null;async function Ee(H){if(W(null),!(!H||H.length===0)){R(!0);try{const le=await rB(H);if(le.files.length===0){W("That folder looks empty — try another?"),R(!1);return}N(le);const he=J_("peek");ae(he),ue(ne=>({...ne,[he]:{text:"",done:!1,error:null}}));const Ce=await fetch("/api/onboarding/peek",{method:"POST",headers:pe,body:JSON.stringify({folderName:le.folderName,files:le.files,totalFiles:le.totalFiles,messageId:he})});if(!Ce.ok){const ne=await Ce.json().catch(()=>({}));throw new Error(ne.error||`peek failed (${Ce.status})`)}}catch(le){W(String(le.message||le))}finally{R(!1)}}}function G(H){F(le=>{const he=new Set(le);return he.has(H)?he.delete(H):he.add(H),he})}const[se,ke]=w.useState(null),[$e,Ve]=w.useState(null),[St,mt]=w.useState(null),z=se?E[se]:null,[q,_e]=w.useState(null),[Q,Re]=w.useState(!1);async function rt(){mt(null),Ve("remix"),Re(!0);try{const he=((await(await fetch("/api/bazaar/shelf",{headers:pe})).json()).recipes||[]).filter(Ce=>Ce.kind!=="theme"&&Ce.source!=="theme").slice().sort((Ce,ne)=>(ne.outcomeScore||0)-(Ce.outcomeScore||0)).slice(0,3);_e(he)}catch{_e([])}finally{Re(!1)}}async function at(H){var he;const le=`Build me “${H.title}”. Use ${((he=H.producer)==null?void 0:he.name)||"the producer"}'s recipe.`;try{await ce({connectedServices:[...j]}),await fetch("/api/agent/onboarded",{method:"POST",headers:pe}),n==null||n({build:le})}catch(Ce){mt(String(Ce.message||Ce))}}async function Tt(H){mt(null),Ve(H);const le=J_("job");ke(le),ue(he=>({...he,[le]:{text:"",done:!1,error:null}}));try{await ce({connectedServices:[...j]});const he=await fetch("/api/onboarding/start-job",{method:"POST",headers:pe,body:JSON.stringify({kind:H,messageId:le,peekFolderName:(P==null?void 0:P.folderName)||null})});if(!he.ok){const Ce=await he.json().catch(()=>({}));throw new Error(Ce.error||`start-job failed (${he.status})`)}}catch(he){mt(String(he.message||he)),ke(null),Ve(null)}}async function tn(){var H;try{await ce({connectedServices:[...j]});const le=await fetch("/api/agent/onboarded",{method:"POST",headers:pe});if(!le.ok){const Ce=await le.json().catch(()=>({}));throw new Error(Ce.error||`mark-onboarded failed (${le.status})`)}let he=null;if(se&&(z!=null&&z.done)&&z.text&&!z.error){const Ce=((H=qe.find(ne=>ne.kind===$e))==null?void 0:H.title)||"Let’s get started";he={messageId:se,userText:Ce,agentText:z.text}}n==null||n(he?{seedChat:he}:void 0)}catch(le){y(String(le.message||le))}}const Ft=o.trim()||"your agent",xt="Hey. I'm new here.",lt="Before we start — what should I call myself?",[It,Ln]=X_(r===1?xt:"",42,340),[An,sr]=X_(r===1&&Ln?lt:"",30,360),Ye=r===1?sr:!0,qe=w.useMemo(()=>iB({peekSummary:P,services:j,agentName:Ft}),[P,j,Ft]),Fe=b?G_[b.status]||G_.login:null,Je=b?Qz.has(b.status):!1;return u.jsx("div",{className:"ob-root",children:u.jsxs("div",{className:"ob-layout",children:[u.jsxs("div",{className:"ob-stage",children:[u.jsxs("div",{className:"fd-brand ob-brand",children:[u.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]}),u.jsxs("header",{className:"ob-header",children:[u.jsx("div",{className:"ob-step-dots","aria-label":`Step ${r} of 4`,children:[1,2,3,4].map(H=>u.jsx("span",{className:`ob-dot ${H===r?"active":""} ${H<r?"done":""}`},H))}),r>1&&!b&&u.jsx("button",{className:"ob-back",onClick:()=>i(r-1),children:"← Back"})]}),b&&Fe&&u.jsxs("section",{className:"ob-step",children:[u.jsxs(oi,{children:[u.jsx("p",{className:"ob-bubble-text",children:Fe.title}),u.jsx("p",{className:"ob-bubble-subtle",children:Fe.subtitle})]}),u.jsxs("div",{className:"ob-card ob-reveal",children:[b.status==="login"?u.jsxs("div",{className:"ob-login-inapp",children:[(!x||x.status==="idle")&&u.jsx("button",{className:"ob-next primary",onClick:be,children:"Sign in to Claude →"}),x&&(x.status==="starting"||x.status==="awaiting-browser")&&u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"ob-bubble-text",children:"Opening Claude in your browser…"}),u.jsx("p",{className:"ob-bubble-subtle",children:"Sign in there with your Claude account — I'll detect it automatically, nothing to come back and click."}),x.url&&u.jsx("a",{className:"ob-login-link",href:x.url,target:"_blank",rel:"noreferrer",children:"If the browser didn't open, click here →"})]}),x&&x.status==="awaiting-code"&&u.jsxs("div",{className:"ob-login-code",children:[u.jsx("label",{className:"ob-label",children:"Paste the code from your browser"}),u.jsxs("div",{className:"ob-actions",children:[u.jsx("input",{className:"ob-input",value:L,onChange:H=>B(H.target.value),placeholder:"code from claude.ai"}),u.jsx("button",{className:"ob-next primary",onClick:Ue,children:"Submit"})]})]}),x&&(x.status==="error"||x.status==="unsupported")&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"ob-error",children:[x.error||"I couldn't run the in-app sign-in."," You can sign in from a terminal instead:"]}),u.jsx("div",{className:"ob-login-cmd",children:u.jsx("code",{children:Fe.cmd})}),u.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:10},children:Fe.after})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("label",{className:"ob-label",children:Fe.cmdLabel}),Fe.cmd?u.jsx("div",{className:"ob-login-cmd",children:u.jsx("code",{children:Fe.cmd})}):u.jsx("a",{className:"ob-login-link",href:Fe.link,target:"_blank",rel:"noreferrer",children:Fe.linkLabel}),u.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:10},children:Fe.after})]}),S&&u.jsx("div",{className:"ob-error",style:{marginTop:12},children:Fe.retry}),u.jsx("div",{className:"ob-actions",children:u.jsx("button",{className:"ob-next primary",onClick:we,disabled:v,children:v?"Checking…":"I've done it — continue →"})}),!Je&&u.jsx("div",{className:"ob-actions",children:u.jsx("button",{className:"ob-skip",onClick:()=>{_(null),i(2)},children:"I already have a plan — continue"})})]})]}),r===1&&!b&&u.jsxs("section",{className:"ob-step",children:[u.jsxs(oi,{streaming:!Ln||!sr,children:[u.jsxs("p",{className:"ob-bubble-text",children:[It,!Ln&&u.jsx(bs,{})]}),Ln&&u.jsxs("p",{className:"ob-bubble-text",children:[An,!sr&&u.jsx(bs,{})]})]}),Ye&&u.jsxs("div",{className:"ob-card ob-reveal",children:[u.jsx("label",{className:"ob-label",children:"Name"}),u.jsx("input",{autoFocus:!0,className:"ob-input",placeholder:"Echo, Pip, Atlas, Sage…",value:o,onChange:H=>a(H.target.value),onKeyDown:H=>{H.key==="Enter"&&Pe()},maxLength:40}),u.jsx("label",{className:"ob-label",children:"Voice"}),u.jsx("div",{className:"ob-tone-grid",children:Xz.map(H=>u.jsxs("button",{className:`ob-tone ${l===H.id?"selected":""}`,onClick:()=>c(H.id),children:[u.jsx("span",{className:"ob-tone-label",children:H.label}),u.jsx("span",{className:"ob-tone-sample",children:H.sample})]},H.id))}),u.jsx("label",{className:"ob-label",children:"Color"}),u.jsx("div",{className:"ob-color-row",children:Y_.map(H=>u.jsx("button",{className:`ob-color-swatch ${d===H?"selected":""}`,style:{background:H},onClick:()=>h(H),"aria-label":`Pick ${H}`},H))}),p&&u.jsx("div",{className:"ob-error",children:p}),u.jsx("div",{className:"ob-actions ob-actions-block",children:u.jsx("button",{className:"ob-next primary ob-next-full",onClick:Pe,disabled:f||!o.trim(),children:f?"Saving…":`I'm ${Ft}. Let's go →`})})]})]}),r===2&&u.jsxs("section",{className:"ob-step",children:[u.jsxs(oi,{children:[u.jsx("p",{className:"ob-bubble-text",children:"Cool. Now — show me something you're working on. Drag a folder onto me."}),u.jsx("p",{className:"ob-bubble-subtle",children:"I'll glance at what's inside so I can react — your files stay on your machine."}),u.jsxs("details",{className:"ob-disclose",children:[u.jsx("summary",{children:"What gets shared?"}),"Just to react, I read filenames plus a short sample of each text file (≤40 files, ≤600 bytes each). That sample goes to Anthropic the same way every chat message does — nothing is uploaded to VentureWild. Pick something you'd be comfortable talking about in chat."]})]}),u.jsxs("div",{className:`ob-dropzone ${D?"over":""} ${A?"peeking":""}`,onDragOver:H=>{H.preventDefault(),I(!0)},onDragLeave:()=>I(!1),onDrop:async H=>{var he,Ce;H.preventDefault(),I(!1);const le=(he=H.dataTransfer)==null?void 0:he.items;if(le&&le.length>0&&le[0].webkitGetAsEntry){const ne=[],Se=async(de,Te="")=>{if(de.isFile)await new Promise(Ne=>de.file(De=>{try{Object.defineProperty(De,"webkitRelativePath",{value:`${Te}${De.name}`})}catch{}ne.push(De),Ne()},Ne));else if(de.isDirectory){const Ne=de.createReader();await new Promise(De=>Ne.readEntries(async Ze=>{for(const gt of Ze)await Se(gt,`${Te}${de.name}/`);De()},De))}};for(const de of le){const Te=de.webkitGetAsEntry();Te&&await Se(Te)}if(ne.length>0){await Ee(ne);return}}await Ee((Ce=H.dataTransfer)==null?void 0:Ce.files)},onClick:()=>{var H;return(H=C.current)==null?void 0:H.click()},children:[u.jsx("input",{ref:C,type:"file",webkitdirectory:"",directory:"",multiple:!0,style:{display:"none"},onChange:H=>Ee(H.target.files)}),A?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"ob-drop-icon",children:"👀"}),u.jsx("div",{className:"ob-drop-title",children:"Looking…"})]}):P?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"ob-drop-icon",children:"📁"}),u.jsx("div",{className:"ob-drop-title",children:P.folderName}),u.jsxs("div",{className:"ob-drop-sub",children:[P.totalFiles," file",P.totalFiles===1?"":"s"," · sampled ",P.files.length]})]}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"ob-drop-icon",children:"📂"}),u.jsx("div",{className:"ob-drop-title",children:"Drop a folder here"}),u.jsx("div",{className:"ob-drop-sub",children:"or click to pick one"})]})]}),re&&u.jsxs(oi,{streaming:!re.done,children:[re.text?u.jsxs("p",{className:"ob-bubble-text ob-bubble-wow",children:[re.text,!re.done&&u.jsx(bs,{})]}):u.jsxs("p",{className:"ob-bubble-subtle",children:["👀 ",Ft," is reading…",!re.done&&u.jsx(bs,{})]}),re.error&&u.jsx("p",{className:"ob-bubble-subtle ob-bubble-error",children:re.error})]}),O&&u.jsx("div",{className:"ob-error",children:O}),u.jsxs("div",{className:"ob-actions",children:[u.jsx("button",{className:"ob-skip",onClick:()=>i(3),children:"Skip — I'd rather just chat"}),u.jsx("button",{className:"ob-next primary",onClick:()=>i(3),disabled:!P&&!O,children:"Next →"})]})]}),r===3&&u.jsxs("section",{className:"ob-step",children:[u.jsxs(oi,{children:[u.jsx("p",{className:"ob-bubble-text",children:"Anything I should keep an eye on?"}),u.jsx("p",{className:"ob-bubble-subtle",children:"Totally optional. Flag what lives in your world and I'll wire it up when these land — you can always add more later."})]}),u.jsx("div",{className:"ob-tile-grid",children:Jz.map(H=>u.jsxs("button",{className:`ob-tile ${j.has(H.id)?"selected":""}`,onClick:()=>G(H.id),children:[u.jsx("span",{className:"ob-tile-label",children:H.label}),u.jsx("span",{className:"ob-tile-note",children:H.note}),j.has(H.id)&&u.jsx("span",{className:"ob-tile-check",children:"✓"})]},H.id))}),u.jsxs("div",{className:"ob-soon",children:["I'll wire these up as they come online — your picks are saved. And I'm not stuck on one device:",s?u.jsxs(u.Fragment,{children:[" open ",u.jsx("code",{children:s})," on your phone with the same login"]}):u.jsx(u.Fragment,{children:" sign in on any device with the same login"})," ","and I'm right there — same memory, same conversation."]}),u.jsxs("div",{className:"ob-actions",children:[u.jsx("button",{className:"ob-skip",onClick:()=>i(4),children:"Skip →"}),u.jsx("button",{className:"ob-next primary",onClick:()=>i(4),children:"Next: first job →"})]})]}),r===4&&u.jsxs("section",{className:"ob-step",children:[u.jsxs(oi,{children:[u.jsx("p",{className:"ob-bubble-text",children:"Right — what should I actually do for you first?"}),u.jsx("p",{className:"ob-bubble-subtle",children:"Pick one and I'll start now. Or close this and just talk to me."})]}),q?u.jsxs("div",{className:"ob-remix",children:[u.jsx(oi,{children:u.jsx("p",{className:"ob-bubble-text",children:P!=null&&P.folderName?`I had a peek at “${P.folderName}.” Here's what other builders made from starts like yours — pick one and I'll build your version.`:"Here's what other builders already got working. Pick one — I'll build your version the moment you land in your workspace."})}),q.length===0?u.jsx("div",{className:"ob-error",children:"The shelf is empty right now — start from scratch instead."}):q.map(H=>{var le,he;return u.jsxs("button",{className:"ob-remix-card",onClick:()=>at(H),children:[u.jsxs("div",{className:"ob-remix-main",children:[u.jsx("span",{className:"ob-remix-title",children:H.title}),u.jsxs("span",{className:"ob-remix-by",children:["by ",((le=H.producer)==null?void 0:le.name)||"a builder"]}),H.pitch&&u.jsx("span",{className:"ob-remix-pitch",children:H.pitch}),((he=H.outcomeStats)==null?void 0:he.builds)>0&&u.jsxs("span",{className:"ob-remix-worked",children:["✓ worked for ",H.outcomeStats.working," of ",H.outcomeStats.builds," builders like you"]})]}),u.jsx("span",{className:"ob-remix-go",children:"Build mine →"})]},H.id)}),u.jsx("div",{className:"ob-actions",children:u.jsx("button",{className:"ob-skip",onClick:()=>{_e(null),Ve(null)},children:"← Pick a different job"})})]}):se?u.jsxs(u.Fragment,{children:[u.jsxs(oi,{streaming:!z||!z.done,children:[z!=null&&z.text?u.jsxs("p",{className:"ob-bubble-text",children:[z.text,!z.done&&u.jsx(bs,{})]}):u.jsxs("p",{className:"ob-bubble-subtle",children:[Ft," is on it…",(!z||!z.done)&&u.jsx(bs,{})]}),(z==null?void 0:z.error)&&u.jsx("p",{className:"ob-bubble-subtle ob-bubble-error",children:z.error})]}),u.jsxs("div",{className:"ob-actions",children:[u.jsx("button",{className:"ob-skip",onClick:()=>{ke(null),Ve(null)},children:"← Pick a different job"}),u.jsx("button",{className:"ob-next primary",onClick:tn,disabled:!z||!z.done&&!z.error,children:z!=null&&z.done?"Open my workspace →":"Streaming…"})]})]}):u.jsxs("div",{className:"ob-jobs",children:[u.jsxs("button",{className:"ob-job ob-job-remix",onClick:rt,disabled:Q,children:[u.jsx("div",{className:"ob-job-title",children:"✦ Remix a proven build"}),u.jsx("div",{className:"ob-job-sub",children:Q?"Pulling up what others have made…":"Start from something other builders already got working — I'll build one for you now."})]}),qe.map(H=>u.jsxs("button",{className:"ob-job",onClick:()=>Tt(H.kind),children:[u.jsx("div",{className:"ob-job-title",children:H.title}),u.jsx("div",{className:"ob-job-sub",children:H.sub})]},H.kind))]}),(p||St)&&u.jsx("div",{className:"ob-error",children:p||St}),!se&&!q&&u.jsx("div",{className:"ob-actions",children:u.jsx("button",{className:"ob-skip",onClick:tn,children:"Skip to chat →"})}),u.jsxs("details",{className:"ob-consent-note",children:[u.jsx("summary",{children:"How VentureWild helps if you get stuck"}),"I quietly share how I'm doing — what's working, what breaks, my setup health — with the VentureWild team so they can help if you ever get stuck. Never your words or files. You can turn this off anytime in Settings."]})]})]}),u.jsx("aside",{className:"ob-aside","aria-hidden":"true",children:u.jsxs("div",{className:"ob-aside-inner",children:[u.jsx("div",{className:"ob-aside-label",children:"✦ Builders like you"}),u.jsx(Jc,{variant:"ambient"})]})})]})})}function oB(e=typeof window<"u"?window.location:null){const t=String((e==null?void 0:e.hostname)||"");if(t.endsWith(".venturewild.llc")){const n=t.split(".")[0];if(n)return`This is ${n.charAt(0).toUpperCase()+n.slice(1)}'s workspace on VentureWild.`}return"Welcome to VentureWild."}const aB={gridTemplateRows:"1fr",background:"radial-gradient(1200px 600px at 12% -10%, var(--canvas-1), transparent 60%),radial-gradient(1000px 700px at 100% 0%, var(--canvas-2), transparent 55%),linear-gradient(160deg, var(--canvas-3), var(--bg) 70%)"},lB={display:"grid",placeItems:"center",minHeight:"100vh",padding:24,textAlign:"center"},cB={maxWidth:440,padding:32,display:"grid",gap:16,justifyItems:"center",textAlign:"center"},uB={margin:0,fontSize:"var(--fs-h2)",fontWeight:700,color:"var(--text)"},hB={margin:0,color:"var(--text-muted)",fontSize:"var(--fs-body)",lineHeight:1.5},dB={margin:0,color:"var(--text-muted)",fontSize:"var(--fs-sm)"},fB={fontSize:36,letterSpacing:"0.16em",fontWeight:700,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:"var(--accent, #22d3ee)"};function pB(e){return e&&e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e}function xh(e=typeof window<"u"?window.location:null){if(!e)return null;const t=String(e.hostname||"");if(!t.endsWith(".venturewild.llc"))return null;const n=t.split(".")[0];return n?`https://sync.venturewild.llc/auth/google/start?slug=${encodeURIComponent(n)}`:null}const mB={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,width:"100%",padding:"13px 18px",borderRadius:"var(--r-lg)",background:"#fff",color:"#1f2937",fontSize:"var(--fs-body)",fontWeight:600,textDecoration:"none",border:"1px solid #dadce0",boxShadow:"0 1px 2px rgba(0,0,0,0.08)"};function gB(){const[e,t]=w.useState("starting"),[n,r]=w.useState(null),[i,s]=w.useState(null),[o,a]=w.useState(0),[l,c]=w.useState(0),d=w.useRef({requestId:null,pollAfterMs:2500}),h=w.useCallback(async()=>{t("starting"),r(null);try{const f=await fetch("/api/auth/pair/start",{method:"POST",headers:{"content-type":"application/json"},body:"{}"});if(f.status===429){t("error"),r("Too many sign-in attempts right now. Wait a minute, then try again.");return}if(!f.ok){t("error"),r("Could not start sign-in. Please try again.");return}const m=await f.json();d.current={requestId:m.requestId,pollAfterMs:m.pollAfterMs||2500},s(m.code),a(m.expiresAt||0),t("waiting")}catch{t("error"),r("Network error. Check your connection and try again.")}},[]);return w.useEffect(()=>{h()},[h]),w.useEffect(()=>{if(e!=="waiting")return;let f=!1,m=null;const{requestId:p,pollAfterMs:y}=d.current;async function b(){try{const _=await fetch("/api/auth/pair/status",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({requestId:p})});if(f)return;const v=await _.json().catch(()=>({}));if(v.status==="approved"&&v.token){if((await fetch("/api/auth/exchange",{method:"POST",headers:{Authorization:`Bearer ${v.token}`}})).ok){window.location.reload();return}t("error"),r("Almost there — sign-in completed but the session could not be saved. Try again.");return}if(v.status==="denied"){t("error"),r("This device was denied.");return}if(v.status==="expired"){t("error"),r("The code expired before it was approved.");return}m=setTimeout(b,y)}catch{f||(m=setTimeout(b,y))}}return m=setTimeout(b,y),()=>{f=!0,clearTimeout(m)}},[e]),w.useEffect(()=>{if(e!=="waiting"||!o)return;const f=()=>c(Math.max(0,Math.round((o-Date.now())/1e3)));f();const m=setInterval(f,1e3);return()=>clearInterval(m)},[e,o]),u.jsx("div",{className:"app fd-wallpaper",style:aB,children:u.jsx("div",{style:lB,children:u.jsxs("div",{className:"fd-card",style:cB,children:[u.jsxs("span",{className:"fd-brand",children:[u.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]}),u.jsx("h2",{style:uB,children:"Sign in to look around"}),u.jsx("p",{style:hB,children:oB()}),xh()&&u.jsxs("a",{href:xh(),style:mB,"data-testid":"google-signin",children:[u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[u.jsx("path",{fill:"#4285F4",d:"M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.92c1.71-1.57 2.68-3.89 2.68-6.62z"}),u.jsx("path",{fill:"#34A853",d:"M9 18c2.43 0 4.47-.8 5.96-2.18l-2.92-2.26c-.81.54-1.84.86-3.04.86-2.34 0-4.32-1.58-5.03-3.7H.96v2.33A9 9 0 0 0 9 18z"}),u.jsx("path",{fill:"#FBBC05",d:"M3.97 10.72A5.41 5.41 0 0 1 3.68 9c0-.6.1-1.18.29-1.72V4.95H.96A9 9 0 0 0 0 9c0 1.45.35 2.82.96 4.05l3.01-2.33z"}),u.jsx("path",{fill:"#EA4335",d:"M9 3.58c1.32 0 2.5.45 3.44 1.35l2.58-2.59C13.46.89 11.43 0 9 0A9 9 0 0 0 .96 4.95l3.01 2.33C4.68 5.16 6.66 3.58 9 3.58z"})]}),"Continue with Google"]}),xh()&&u.jsx("p",{style:dB,children:"or approve from another device you’re signed in on:"}),e==="starting"&&u.jsxs("p",{style:{color:"var(--text-muted)"},children:[u.jsx("span",{className:"spinner"})," Preparing…"]}),e==="waiting"&&u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{color:"var(--text-muted)",margin:0},children:"On a device where you’re already signed in, open this workspace and approve this code:"}),u.jsx("div",{style:fB,"data-testid":"pair-code",children:pB(i)}),u.jsxs("p",{style:{color:"var(--text-muted)",fontSize:13,margin:0},children:["Waiting for approval",l?` · expires in ${l}s`:"","…"]})]}),e==="error"&&u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{color:"var(--error)"},children:n}),u.jsx("button",{onClick:h,children:"Try again"})]})]})})})}const yB={position:"fixed",top:12,left:"50%",transform:"translateX(-50%)",zIndex:1e3,background:"var(--surface, #1e293b)",border:"1px solid var(--accent, #22d3ee)",borderRadius:10,padding:"12px 16px",boxShadow:"0 8px 24px rgba(0,0,0,0.35)",display:"grid",gap:10,maxWidth:460},_B={display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},vB={fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:"0.12em",fontWeight:700,color:"var(--accent, #22d3ee)"};function bB(e){return e&&e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e}function wB({token:e}){const[t,n]=w.useState([]),[r,i]=w.useState(null),[s,o]=w.useState(null),a=w.useRef(!0),l=w.useCallback((h={})=>e?{Authorization:`Bearer ${e}`,...h}:h,[e]),c=w.useCallback(async()=>{try{const h=await fetch("/api/auth/pair/requests",{headers:l()});if(!h.ok)return;const f=await h.json();a.current&&n(Array.isArray(f.requests)?f.requests:[])}catch{}},[l]);w.useEffect(()=>{a.current=!0,c();const h=setInterval(c,5e3);return()=>{a.current=!1,clearInterval(h)}},[c]);async function d(h,f,m){if(!r){i(h),o(null);try{const p=await fetch(`/api/auth/pair/${f}`,{method:"POST",headers:l({"content-type":"application/json"}),body:JSON.stringify({requestId:h})});p.ok&&f==="approve"?o({ok:!0,text:`Approved ${m}.`}):p.ok||o({ok:!1,text:"That request is no longer waiting."})}catch{o({ok:!1,text:"Network error."})}finally{i(null),c()}}}return t.length===0?null:u.jsxs("div",{style:yB,"data-testid":"pair-approvals",children:[u.jsx("strong",{style:{fontSize:13},children:t.length===1?"A device wants to sign in":`${t.length} devices want to sign in`}),u.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Check that the code matches the one on that device, then approve."}),t.map(h=>u.jsxs("div",{style:_B,children:[u.jsx("span",{style:{fontSize:13},children:h.label}),u.jsx("span",{style:vB,"data-testid":"pair-request-code",children:bB(h.code)}),u.jsx("span",{className:"spacer",style:{flex:1}}),u.jsx("button",{onClick:()=>d(h.requestId,"approve",h.label),disabled:r===h.requestId,"data-testid":"pair-approve-btn",children:r===h.requestId?"Approving…":"Approve"}),u.jsx("button",{onClick:()=>d(h.requestId,"deny",h.label),disabled:r===h.requestId,style:{background:"transparent",color:"var(--text-muted)"},children:"Deny"})]},h.requestId)),s&&u.jsx("span",{style:{fontSize:12,color:s.ok?"var(--accent, #22d3ee)":"var(--error)"},children:s.text})]})}const SB=15e3,xB=2500;function kB(e){const t=Math.round(e/6e4);return t<=0?"expiring":t<60?`${t} min`:`${Math.floor(t/60)}h ${t%60}m`}function CB({token:e}){var g;const[t,n]=w.useState(null),[r,i]=w.useState(!1),[s,o]=w.useState(!1),a=w.useRef(null),l=w.useRef(null),c=w.useCallback(()=>e?{Authorization:`Bearer ${e}`}:{},[e]),d=w.useCallback(async()=>{try{const S=await fetch("/api/support/status",{headers:c()});if(!S.ok)return;n(await S.json())}catch{}},[c]),h=!!((g=t==null?void 0:t.operate)!=null&&g.active);w.useEffect(()=>{d();const S=h?xB:SB;return a.current=setInterval(d,S),()=>clearInterval(a.current)},[d,h]),w.useLayoutEffect(()=>{const S=()=>{const k=l.current?l.current.offsetHeight:0;document.documentElement.style.setProperty("--support-banner-h",`${k}px`)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)}),w.useEffect(()=>()=>document.documentElement.style.setProperty("--support-banner-h","0px"),[]);const f=w.useCallback(async()=>{i(!0);try{await fetch("/api/support/revoke",{method:"POST",headers:c()})}catch{}i(!1),d()},[c,d]),m=w.useCallback(async()=>{o(!0);try{await fetch("/api/support/operate/cancel",{method:"POST",headers:c()})}catch{}o(!1),d()},[c,d]);if(!t)return null;const p=t.operate||null;if(!t.enabled&&!t.active&&!p)return null;if(p){const S=(p.lines||[]).slice(-6);return u.jsxs("div",{ref:l,role:"status","aria-live":"polite",style:Z_(!0),children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,width:"100%"},children:[u.jsx("span",{"aria-hidden":"true",children:"⚙️"}),u.jsx("span",{style:{fontWeight:600},children:p.active?"VentureWild support is operating your agent":"VentureWild support finished helping"}),p.active&&u.jsx("button",{type:"button",onClick:m,disabled:s,style:kh,children:s?"Stopping…":"Stop"}),u.jsx("button",{type:"button",onClick:f,disabled:r,style:{...kh,marginLeft:p.active?0:"auto"},children:r?"Revoking…":"Revoke access"})]}),S.length>0&&u.jsx("div",{"data-testid":"operate-transcript",style:{width:"100%",marginTop:4,maxHeight:96,overflowY:"auto",font:"12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace",opacity:.92,whiteSpace:"pre-wrap"},children:S.map((k,x)=>u.jsx("div",{children:k.text},`${k.ts}-${x}`))})]})}const b=t.active,_=b?"VentureWild support is connected":`Support access allowed (tier ${t.tier})`,v=b?t.lastAction?`last action: ${t.lastAction.action}`:"a support session is live":`auto-expires in ${kB(t.remainingMs)}`;return u.jsxs("div",{ref:l,role:"status","aria-live":"polite",style:Z_(b),children:[u.jsx("span",{"aria-hidden":"true",children:b?"🟢":"🛟"}),u.jsx("span",{style:{fontWeight:600},children:_}),u.jsxs("span",{style:{opacity:.8},children:["· ",v]}),u.jsx("button",{type:"button",onClick:f,disabled:r,style:{...kh,marginLeft:"auto"},children:r?"Revoking…":"Revoke"})]})}function Z_(e){return{position:"fixed",top:0,left:0,right:0,zIndex:9999,display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"6px 14px",background:e?"var(--accent, #0891b2)":"var(--surface-2, #f4f4f5)",color:e?"var(--accent-ink, #fff)":"var(--text, #222)",borderBottom:"1px solid var(--border, #e4e4e7)",boxShadow:"0 1px 6px rgba(0,0,0,0.12)",font:"13px/1.4 -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"}}const kh={padding:"3px 12px",borderRadius:6,border:"1px solid currentColor",background:"transparent",color:"inherit",cursor:"pointer",fontWeight:600},EB={partner:"Partner",viewer:"Viewer",client:"Client"},Ss=12,zi=[{id:"chat-1",type:"chat"}],NB={lg:[{i:"chat-1",x:0,y:0,w:12,h:Ss,minW:3,minH:4}]},jB={chat:{w:5,h:12},liveview:{w:4,h:12},notes:{w:3,h:6},earnings:{w:3,h:5},analytics:{w:4,h:7},usage:{w:3,h:6},powers:{w:3,h:7},files:{w:3,h:12},code:{w:5,h:12},todo:{w:3,h:7},logs:{w:4,h:8},datatable:{w:6,h:8},deploy:{w:4,h:7},peers:{w:3,h:6}},RB=[{type:"liveview",title:"Live view",icon:"👁️",desc:"See what your agent builds, live."},{type:"files",title:"Files",icon:"📁",desc:"Browse your workspace files.",cap:"fileTree"},{type:"code",title:"Code",icon:"💻",desc:"View a file, with highlighting.",cap:"fileTree"},{type:"notes",title:"Notes",icon:"📝",desc:"A place to jot anything."},{type:"todo",title:"To-do",icon:"✅",desc:"A simple checklist."},{type:"logs",title:"Logs",icon:"📋",desc:"Tail your workspace logs, live.",cap:"fileTree"},{type:"datatable",title:"Data table",icon:"🗂️",desc:"View a CSV or JSON file as a sortable table.",cap:"fileTree"},{type:"deploy",title:"Deploy",icon:"🚀",desc:"Put your build online (agent-driven)."},{type:"usage",title:"Usage",icon:"🔋",desc:"Your plan usage + working memory, live."},{type:"powers",title:"Powers",icon:"🧰",desc:"Your skills — one tap to run."},{type:"peers",title:"Builders like you",icon:"🌱",desc:"Real things real people built here."},{type:"chat",title:"Another chat",icon:"🗨️",desc:"A second, independent conversation."}],TB=[{type:"earnings",title:"Producer earnings",icon:"💸",desc:"Watch represented earnings tick in, live."},{type:"analytics",title:"Shelf analytics",icon:"📊",desc:"Who's earning across the marketplace."}],DB=[{id:"just-chat",name:"Just chat",icon:"💬",desc:"Only the conversation — clean and focused.",blocks:[{type:"chat",l:{x:0,y:0,w:12,h:12,minW:3,minH:4}}]},{id:"build",name:"Build",icon:"🔨",desc:"Chat, a live view, and your powers.",blocks:[{type:"chat",l:{x:0,y:0,w:6,h:12,minW:3,minH:4}},{type:"liveview",l:{x:6,y:0,w:6,h:8,minW:3,minH:3}},{type:"powers",l:{x:6,y:8,w:6,h:4,minW:3,minH:3}}]},{id:"producer",name:"Producer",icon:"💸",desc:"Chat + your earnings, usage, and the shelf.",blocks:[{type:"chat",l:{x:0,y:0,w:6,h:12,minW:3,minH:4}},{type:"earnings",l:{x:6,y:0,w:6,h:4,minW:3,minH:3}},{type:"usage",l:{x:6,y:4,w:6,h:4,minW:3,minH:3}},{type:"analytics",l:{x:6,y:8,w:6,h:4,minW:3,minH:3}}]},{id:"workspace",name:"Workspace",icon:"📝",desc:"Chat, a live view, your usage, and notes.",blocks:[{type:"chat",l:{x:0,y:0,w:6,h:12,minW:3,minH:4}},{type:"liveview",l:{x:6,y:0,w:6,h:6,minW:3,minH:3}},{type:"usage",l:{x:6,y:6,w:6,h:3,minW:3,minH:3}},{type:"notes",l:{x:6,y:9,w:6,h:3,minW:3,minH:3}}]},{id:"code",name:"Code",icon:"💻",desc:"Chat with a file browser and a code view.",cap:"fileTree",blocks:[{type:"chat",l:{x:0,y:0,w:4,h:12,minW:3,minH:4}},{type:"files",l:{x:4,y:0,w:3,h:12,minW:2,minH:4}},{type:"code",l:{x:7,y:0,w:5,h:12,minW:3,minH:4}}]}];let Q_=0;function jo(e){return Q_+=1,`${e}-${Date.now().toString(36)}-${Q_}`}function PB(e=640){const[t,n]=w.useState(()=>typeof window<"u"&&window.innerWidth<=e);return w.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(`(max-width: ${e}px)`),i=()=>n(r.matches);return i(),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[e]),t}function LB(){var $t,Pi,qn,Zr,Li,it;const[e,t]=w.useState(null),[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,a]=w.useState(()=>!Is()),[l,c]=w.useState(()=>!Is()),[d,h]=w.useState(()=>Is()),[f,m]=w.useState(!1),[p,y]=w.useState(!1),[b,_]=w.useState(null),[v,g]=w.useState(!1),[S,k]=w.useState(!1),[x,T]=w.useState(!1),[L,B]=w.useState("build"),[j,F]=w.useState({}),[A,R]=w.useState(null),[P,N]=w.useState(null),[O,W]=w.useState(null),[D,I]=w.useState(null),[C,X]=w.useState(!1),[ie,E]=w.useState(null),[ue,ve]=w.useState("use"),[Z,pe]=w.useState(!1),[ce,ge]=w.useState(!1),[Pe,we]=w.useState(!1),[Be,be]=w.useState(!1),[Ue,M]=w.useState(()=>typeof window<"u"?VA():{mode:"light",accent:"#0891b2",hot:"#0e7490",accentManual:!1}),[ae,re]=w.useState(null),[Ee,G]=w.useState(()=>{try{const $=JSON.parse(localStorage.getItem("wild:templates")||"[]");return Array.isArray($)?$:[]}catch{return[]}}),[se,ke]=w.useState(zi),[$e,Ve]=w.useState(NB),[St,mt]=w.useState(!1),[z,q]=w.useState("chat-1"),_e=PB(),Q=w.useMemo(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("t"),[]);w.useEffect(()=>{async function $(){try{const ee={};Q&&(ee.Authorization=`Bearer ${Q}`);const K=await fetch("/api/session",{headers:ee});if(K.status===401){s(!0);return}if(!K.ok)throw new Error(`session fetch failed: ${K.status}`);const oe=await K.json();t(oe)}catch(ee){r(ee.message||String(ee))}}$()},[Q,d]),w.useEffect(()=>{KA(Ue),qA(Ue)},[Ue]),w.useEffect(()=>{var ee;const $=(ee=e==null?void 0:e.identity)==null?void 0:ee.color;$&&!Ue.accentManual&&M(K=>K.accentManual?K:{...K,accent:$,hot:$})},[($t=e==null?void 0:e.identity)==null?void 0:$t.color,Ue.accentManual]);const Re=e!=null&&e.workspaceId?`wild:canvas:v2:${e.workspaceId}:${e.personKey||"local"}`:null,rt=w.useRef(null);function at($){clearTimeout(rt.current),rt.current=setTimeout(()=>{const ee={"Content-Type":"application/json"};Q&&(ee.Authorization=`Bearer ${Q}`),fetch("/api/canvas/state",{method:"POST",headers:ee,body:JSON.stringify($)}).catch(()=>{})},800)}w.useEffect(()=>{if(!Re||St)return;let $=!1;const ee=Q?{Authorization:`Bearer ${Q}`}:{};return(async()=>{var K,oe,ye,Ke,Me,Dt,yr,Ai;try{const Kn=await fetch("/api/canvas/state",{headers:ee});if(!Kn.ok)throw new Error(Kn.status);const Pt=await Kn.json();if($)return;let gn=null;try{gn=JSON.parse(localStorage.getItem(Re))}catch{}if((oe=(K=Pt.layout)==null?void 0:K.blocks)!=null&&oe.length||(Me=(Ke=(ye=Pt.layout)==null?void 0:ye.layouts)==null?void 0:Ke.lg)!=null&&Me.length){let Ht=Array.isArray(Pt.layout.blocks)&&Pt.layout.blocks.length?Pt.layout.blocks:zi;Ht.some(Qr=>Qr.type==="chat")||(Ht=[...zi,...Ht]),ke(Ht),(Dt=Pt.layout.layouts)!=null&&Dt.lg&&Ve(Pt.layout.layouts);try{localStorage.setItem(Re,JSON.stringify({blocks:Ht,layouts:Pt.layout.layouts}))}catch{}}else if((yr=gn==null?void 0:gn.blocks)!=null&&yr.length){let Ht=Array.isArray(gn.blocks)&&gn.blocks.length?gn.blocks:zi;Ht.some(Qr=>Qr.type==="chat")||(Ht=[...zi,...Ht]),ke(Ht),(Ai=gn.layouts)!=null&&Ai.lg&&Ve(gn.layouts),at({layout:{blocks:Ht,layouts:gn.layouts||{lg:[]}}})}if(Array.isArray(Pt.templates)&&Pt.templates.length){G(Pt.templates);try{localStorage.setItem("wild:templates",JSON.stringify(Pt.templates))}catch{}}if(Pt.userTheme){const Ht=Pt.userTheme;M(Qr=>({...Qr,mode:Ht.mode==="dark"?"dark":"light",accent:Ht.accent||Qr.accent,hot:Ht.hot||Qr.hot,accentManual:Ht.accentManual??Qr.accentManual,tokens:Ht.tokens||{}}))}}catch{if($)return;try{const Kn=localStorage.getItem(Re);if(Kn){const Pt=JSON.parse(Kn);let gn=Array.isArray(Pt.blocks)&&Pt.blocks.length?Pt.blocks:zi;gn.some(Ht=>Ht.type==="chat")||(gn=[...zi,...gn]),ke(gn),Pt.layouts&&Pt.layouts.lg&&Ve(Pt.layouts)}}catch{}}$||mt(!0)})(),()=>{$=!0,clearTimeout(rt.current)}},[Re]),w.useEffect(()=>{if(!(!Re||!St)){try{localStorage.setItem(Re,JSON.stringify({blocks:se,layouts:$e}))}catch{}at({layout:{blocks:se,layouts:$e}})}},[Re,St,se,$e]);const Tt=w.useRef(null);w.useEffect(()=>{if(St)return clearTimeout(Tt.current),Tt.current=setTimeout(()=>{at({userTheme:Ue})},800),()=>clearTimeout(Tt.current)},[St,Ue]),w.useEffect(()=>{var K;if(!St||!((K=e==null?void 0:e.capabilities)!=null&&K.chat))return;let $=!1;const ee=Q?{Authorization:`Bearer ${Q}`}:{};return fetch("/api/canvas/blocks",{headers:ee}).then(oe=>oe.ok?oe.json():null).then(oe=>{$||!Array.isArray(oe==null?void 0:oe.blocks)||!oe.blocks.length||(ke(ye=>{const Ke=new Set(ye.map(Dt=>Dt.id)),Me=oe.blocks.filter(Dt=>Dt.id&&!Ke.has(Dt.id));return Me.length?[...ye,...Me.map(Dt=>({id:Dt.id,type:"custom",spec:Dt}))]:ye}),Ve(ye=>{const Ke=ye.lg||[],Me=new Set(Ke.map(yr=>yr.i)),Dt=oe.blocks.filter(yr=>yr.id&&!Me.has(yr.id));return Dt.length?{lg:[...Ke,...Dt.map((yr,Ai)=>({i:yr.id,x:8,y:Ai*6,w:4,h:6,minW:3,minH:3}))]}:ye}))}).catch(()=>{}),()=>{$=!0}},[St,(Pi=e==null?void 0:e.capabilities)==null?void 0:Pi.chat,Q]),w.useEffect(()=>{var K;if(!((K=e==null?void 0:e.capabilities)!=null&&K.chat)||Ue.accentManual)return;let $=!1;const ee=Q?{Authorization:`Bearer ${Q}`}:{};return fetch("/api/canvas/theme",{headers:ee}).then(oe=>oe.ok?oe.json():null).then(oe=>{$||!(oe!=null&&oe.theme)||M(ye=>ye.accentManual?ye:{...ye,mode:oe.theme.mode==="dark"?"dark":"light",accent:oe.theme.accent||ye.accent,hot:oe.theme.hot||oe.theme.accent||ye.hot,tokens:oe.theme.tokens||{}})}).catch(()=>{}),()=>{$=!0}},[(qn=e==null?void 0:e.capabilities)==null?void 0:qn.chat,Q]);function tn($){const ee=jo($),K=jB[$]||{w:4,h:12};if(ke(oe=>[...oe,{id:ee,type:$}]),Ve(oe=>{const ye=oe.lg||[],Ke=ye.reduce((Me,Dt)=>Math.max(Me,(Dt.y||0)+(Dt.h||0)),0);return{lg:[...ye,{i:ee,x:Math.max(0,12-K.w),y:Ke,w:K.w,h:K.h,minW:3,minH:3}]}}),q(ee),pe(!1),typeof window<"u"){const oe=ye=>{var Ke;return(Ke=document.querySelector(`[data-rgl-id="${ee}"]`))==null?void 0:Ke.scrollIntoView({behavior:ye,block:"nearest"})};setTimeout(()=>oe("smooth"),300),setTimeout(()=>oe("auto"),750)}}function Ft($){const ee=se.find(K=>K.id===$);if(ke(K=>K.filter(oe=>oe.id!==$)),Ve(K=>({lg:(K.lg||[]).filter(oe=>oe.i!==$)})),q(K=>{var oe;return K===$?((oe=se.find(ye=>ye.type==="chat"))==null?void 0:oe.id)||"chat-1":K}),F(K=>{if(!($ in K))return K;const oe={...K};return delete oe[$],oe}),(ee==null?void 0:ee.type)==="custom"){const K=Q?{Authorization:`Bearer ${Q}`}:{};fetch(`/api/canvas/blocks/${encodeURIComponent($)}`,{method:"DELETE",headers:K}).catch(()=>{})}}function xt($){const ee=se.find(K=>K.id===$);ee&&tn(ee.type)}const lt=w.useRef(se);lt.current=se;const It=w.useRef(null),Ln=w.useRef(null),An=w.useRef(!1);w.useEffect(()=>{var ye;if(!((ye=e==null?void 0:e.capabilities)!=null&&ye.chat)||_e)return;let $=!1,ee=null;const K=Q?{Authorization:`Bearer ${Q}`}:{},oe=async()=>{var Ai;if($||An.current||document.hidden)return;const Ke=await fetch("/api/preview/ports",{headers:K}).catch(()=>null);if(!Ke||$)return;const Dt=((await Ke.json().catch(()=>({}))).ports||[]).map(Kn=>Kn.port);if(Ln.current===null){Ln.current=new Set(Dt);return}Dt.some(Kn=>!Ln.current.has(Kn))&&!lt.current.some(Kn=>Kn.type==="liveview")&&(An.current=!0,clearInterval(ee),(Ai=It.current)==null||Ai.call(It))};return oe(),ee=setInterval(oe,5e3),()=>{$=!0,clearInterval(ee)}},[(Zr=e==null?void 0:e.capabilities)==null?void 0:Zr.chat,Q,_e]);function sr(){if(se.some(ee=>ee.type==="liveview"))return;const $=jo("liveview");ke(ee=>ee.some(K=>K.type==="liveview")?ee:[...ee,{id:$,type:"liveview"}]),Ve(ee=>{const K=(ee.lg||[]).map(oe=>oe.i.startsWith("chat")?{...oe,w:6,x:0,h:Ss}:oe);return K.push({i:$,x:6,y:0,w:6,h:Ss,minW:3,minH:4}),{lg:K}})}It.current=sr;function Ye($){if(I($),se.some(K=>K.type==="code"))return;const ee=jo("code");ke(K=>K.some(oe=>oe.type==="code")?K:[...K,{id:ee,type:"code"}]),Ve(K=>({lg:[...K.lg||[],{i:ee,x:6,y:0,w:6,h:Ss,minW:3,minH:4}]}))}function qe($,ee){if($!=null&&$.id&&(ke(K=>{const oe=K.findIndex(ye=>ye.id===$.id);if(oe>=0){const ye=K.slice();return ye[oe]={...ye[oe],type:"custom",spec:$},ye}return[...K,{id:$.id,type:"custom",spec:$}]}),Ve(K=>{const oe=K.lg||[];return oe.some(ye=>ye.i===$.id)?K:{lg:[...oe,{i:$.id,x:8,y:0,w:4,h:6,minW:3,minH:3}]}}),ee!=="update"&&(q($.id),typeof window<"u"))){const K=oe=>{var ye;return(ye=document.querySelector(`[data-rgl-id="${$.id}"]`))==null?void 0:ye.scrollIntoView({behavior:oe,block:"nearest"})};setTimeout(()=>K("smooth"),300),setTimeout(()=>K("auto"),750)}}function Fe($){!$||typeof $!="object"||M(ee=>{var K;return UA(ee,$,ee.accentManual||!!((K=e==null?void 0:e.identity)!=null&&K.color))})}async function Je({title:$,pitch:ee}){const K={"content-type":"application/json",...Q?{Authorization:`Bearer ${Q}`}:{}},oe={title:$,pitch:ee,theme:{mode:Ue.mode,accent:Ue.accent,hot:Ue.hot,tokens:Ue.tokens||{}},builtFrom:ae?{id:ae.id,title:ae.title}:null};return(await fetch("/api/bazaar/themes/publish",{method:"POST",headers:K,body:JSON.stringify(oe)})).json().catch(()=>({ok:!1,error:"bad-response"}))}function dt($){const ee=$&&$.theme||{};M(K=>({...K,mode:ee.mode==="dark"?"dark":"light",accent:ee.accent||K.accent,hot:ee.hot||ee.accent||K.hot,tokens:ee.tokens||{},accentManual:!0})),re({id:$.id,title:$.title}),we(!0)}function kt($){var oe;const ee=[],K=$.blocks.map(ye=>{const Ke=jo(ye.type);return ee.push({i:Ke,...ye.l||{x:0,y:0,w:4,h:Ss,minW:3,minH:3}}),{id:Ke,type:ye.type}});if(!K.some(ye=>ye.type==="chat")){const ye=jo("chat");K.unshift({id:ye,type:"chat"}),ee.unshift({i:ye,x:0,y:0,w:8,h:Ss,minW:3,minH:4})}ke(K),Ve({lg:ee}),q(((oe=K[0])==null?void 0:oe.id)||"chat-1"),ge(!1),typeof window<"u"&&setTimeout(()=>{var ye;return(ye=document.querySelector(".block-canvas"))==null?void 0:ye.scrollTo({top:0,behavior:"smooth"})},60)}function Ct($){try{localStorage.setItem("wild:templates",JSON.stringify($))}catch{}return at({templates:$}),$}function Et($){const ee=$e.lg||[],K=se.map(ye=>{const Ke=ee.find(Me=>Me.i===ye.id);return{type:ye.type,l:Ke?{x:Ke.x,y:Ke.y,w:Ke.w,h:Ke.h,minW:Ke.minW??3,minH:Ke.minH??4}:{x:0,y:0,w:4,h:10,minW:3,minH:4}}}),oe={id:`saved-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,name:$,icon:"⭐",desc:"Your saved layout",blocks:K,custom:!0};G(ye=>Ct([...ye,oe]))}function H($){G(ee=>Ct(ee.filter(K=>K.id!==$)))}if(i)return u.jsx(gB,{});if(n)return u.jsx("div",{className:"app",style:{gridTemplateRows:"1fr",alignItems:"center",justifyItems:"center"},children:u.jsxs("div",{style:{padding:24},children:[u.jsx("h2",{children:"wild-workspace"}),u.jsxs("p",{style:{color:"var(--error)"},children:["Could not load session: ",n]}),u.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:"Verify the server is running and the share URL token is valid."})]})});if(!e)return u.jsx("div",{className:"app",style:{gridTemplateRows:"1fr",alignItems:"center",justifyItems:"center"},children:u.jsxs("div",{style:{padding:24,color:"var(--text-muted)"},children:[u.jsx("span",{className:"spinner"})," Loading workspace…"]})});if((Li=e.capabilities)!=null&&Li.chatWrite&&!e.onboarded)return u.jsx(sB,{session:e,token:Q,onComplete:async $=>{$!=null&&$.seedChat&&iP($.seedChat,void 0,Ju(e.currentWorkspace));try{const ee={};Q&&(ee.Authorization=`Bearer ${Q}`);const K=await fetch("/api/session",{headers:ee});K.ok?t(await K.json()):t({...e,onboarded:!0})}catch{t({...e,onboarded:!0})}$!=null&&$.build&&E({text:$.build,ts:Date.now()})}});if(o)return u.jsx(SP,{session:e,autoEnterSingle:l,onEnter:$=>{$!==d&&(sP($),h($),I(null),E(null)),a(!1)},onClose:Is()?()=>a(!1):null});const{role:le,capabilities:he,workspace:Ce,workspaceId:ne,agent:Se,identity:de}=e,Te=(de==null?void 0:de.name)||(Se==null?void 0:Se.label)||"Chat",Ne=e.currentWorkspace||{},De=Ne.id||"default";Ju(Ne);const Ze=(it=se.find($=>$.type==="chat"))==null?void 0:it.id;function gt($){var ee,K;switch($.type){case"chat":return{title:Te,icon:"🗨️"};case"liveview":return{title:"Live view",icon:"👁️"};case"notes":return{title:"Notes",icon:"📝"};case"usage":return{title:"Usage",icon:"🔋"};case"powers":return{title:"Powers",icon:"🧰"};case"earnings":return{title:"Producer earnings",icon:"💸"};case"analytics":return{title:"Shelf analytics",icon:"📊"};case"files":return{title:"Files",icon:"📁"};case"code":return{title:"Code",icon:"💻"};case"todo":return{title:"To-do",icon:"✅"};case"logs":return{title:"Logs",icon:"📋"};case"datatable":return{title:"Data table",icon:"🗂️"};case"deploy":return{title:"Deploy",icon:"🚀"};case"peers":return{title:"Builders like you",icon:"🌱"};case"custom":return{title:((ee=$.spec)==null?void 0:ee.title)||"Block",icon:((K=$.spec)==null?void 0:K.icon)||"🧩"};default:return{title:$.type,icon:"▫️"}}}function tt($){switch($.type){case"chat":{const ee=$.id===Ze,K=ee?void 0:$.id,oe=Ju(Ne,K),ye=ee?L:j[$.id]||"build",Ke=ee?B:Me=>F(Dt=>({...Dt,[$.id]:Me}));return u.jsxs(u.Fragment,{children:[he.chatWrite&&u.jsx("div",{className:"chat-block-bar",children:u.jsxs("span",{className:"chat-mode-toggle","data-testid":"mode-toggle",children:[u.jsx("button",{className:ye==="build"?"active":"",onClick:()=>Ke("build"),"data-testid":"mode-build",children:"Build"}),u.jsx("button",{className:ye==="plan"?"active":"",onClick:()=>Ke("plan"),"data-testid":"mode-plan",children:"Plan"})]})}),ee&&he.inbox&&u.jsx(Vz,{}),u.jsx(lP,{storageKey:oe,threadId:K,role:le,capabilities:he,mode:ye,token:Q,inject:ee?ie:void 0,agentName:Te,onBazaarEvent:Me=>{(Me==null?void 0:Me.type)==="preview"?(R({url:Me.url,ts:Me.ts}),sr()):(Me==null?void 0:Me.type)==="meter"?N(Me.state):(Me==null?void 0:Me.type)==="usage"?W(Me.state):(Me==null?void 0:Me.type)==="block"?qe(Me.block,Me.op):(Me==null?void 0:Me.type)==="theme"&&Fe(Me.theme)}},`chat-${oe}`)]})}case"liveview":return u.jsx(QA,{bazaarPreview:A});case"notes":return u.jsx(eI,{id:$.id});case"usage":return u.jsx(sI,{live:O,token:Q});case"powers":return u.jsx(oI,{token:Q,onRun:ee=>E({text:`/${ee}`,ts:Date.now()})});case"earnings":return u.jsx(rI,{live:P,token:Q});case"analytics":return u.jsx(aI,{live:P,token:Q});case"files":return u.jsx(lI,{token:Q,selectedFile:D,onOpenFile:Ye},`files-${De}`);case"code":return u.jsx(hI,{path:D,token:Q,onPickFile:I},`code-${De}`);case"todo":return u.jsx(dI,{id:$.id});case"logs":return u.jsx(mI,{token:Q});case"datatable":return u.jsx(_I,{token:Q});case"deploy":return u.jsx(vI,{canDeploy:he.chatWrite,onSetup:()=>E({text:"Help me deploy this project — set up a deploy target and ship it.",ts:Date.now()})});case"peers":return u.jsx(Jc,{variant:"block"});case"custom":return u.jsx(Lz,{spec:$.spec});default:return null}}return u.jsxs("div",{className:"app",children:[u.jsx(CB,{token:Q}),he.share&&u.jsx(wB,{token:Q}),u.jsxs("header",{className:"topbar","data-testid":"topbar",children:[u.jsx("span",{className:"brand",children:"wild-workspace"}),u.jsx("span",{className:`badge ${le}`,"data-testid":"role-badge",children:EB[le]||le}),u.jsxs("button",{className:"badge","data-testid":"workspace-switcher",onClick:()=>{c(!1),a(!0)},title:"Switch workspace",style:{cursor:"pointer"},children:[Ne.name||(Ce==null?void 0:Ce.name)||ne," ▾"]}),de!=null&&de.name?u.jsx("span",{className:"badge","data-testid":"agent-name",style:{borderColor:de.color,color:de.color},children:de.name}):Se&&u.jsx("span",{className:"badge","data-testid":"agent-name",children:Se.label||Se.id}),u.jsx("span",{className:"spacer"}),u.jsx("button",{onClick:()=>we(!0),"data-testid":"theme-btn",title:"Theme — make it yours (light/dark + accent)",children:"🎨 Theme"}),he.chatWrite&&u.jsx("button",{onClick:()=>ge(!0),"data-testid":"templates-btn",title:"Start from a template layout",children:"▾ Templates"}),he.chatWrite&&u.jsx("button",{className:ue==="layout"?"primary":"",onClick:()=>ve($=>$==="layout"?"use":"layout"),"data-testid":"arrange-toggle",title:"Rearrange your blocks",children:ue==="layout"?"✓ Done":"✥ Arrange"}),he.chat&&u.jsx("button",{onClick:()=>X(!0),"data-testid":"bazaar-btn",title:"Browse the marketplace shelf",children:"🛍️ Bazaar"}),(()=>{const $=he.chatWrite&&u.jsx("button",{onClick:()=>be(!0),"data-testid":"settings-btn",title:"Settings — agent autonomy, name, appearance",children:"⚙️ Settings"},"settings"),ee=he.sync&&u.jsx("button",{onClick:()=>y(!0),"data-testid":"collaborate-btn",children:"🤝 Collaborate"},"collab"),K=he.share&&u.jsx("button",{onClick:()=>m(!0),"data-testid":"share-btn",children:"🔗 Share"},"share"),oe=he.terminal&&u.jsx("button",{onClick:()=>k(Ke=>!Ke),"data-testid":"terminal-toggle",children:S?"⌨ Hide terminal":"⌨ Terminal"},"term"),ye=[$,ee,K,oe].filter(Boolean);return ye.length===0?null:u.jsxs("div",{className:"topbar-more","data-testid":"topbar-more",children:[u.jsx("button",{onClick:()=>T(Ke=>!Ke),"data-testid":"more-toggle","aria-haspopup":"menu","aria-expanded":x,title:"More — settings, sharing, advanced",children:"⋯ More"}),x&&u.jsx("div",{className:"more-menu",role:"menu","data-testid":"more-menu",onClick:()=>T(!1),children:ye})]})})()]}),u.jsxs("main",{className:"canvas-wrap","data-testid":"canvas-wrap",children:[ue==="layout"&&u.jsxs("div",{className:"arrange-bar","data-testid":"arrange-bar",children:[u.jsx("span",{className:"arrange-hint",children:"✥ Arranging your space — drag a block's header, resize from its corner, or add a new one."}),u.jsx("span",{className:"spacer"}),u.jsx("button",{className:"primary",onClick:()=>pe(!0),"data-testid":"add-block-btn",children:"+ Add block"}),u.jsx("button",{onClick:()=>ve("use"),children:"Done"})]}),_e?u.jsx(BA,{blocks:se,activeId:z,setActiveId:q,mode:ue,renderBlock:tt,blockMeta:gt,onRemove:Ft,canRemove:$=>$.type!=="chat"||$.id!==Ze}):u.jsx(zA,{blocks:se,layouts:$e,mode:ue,onLayoutChange:Ve,renderBlock:tt,blockMeta:gt,onRemove:Ft,onDuplicate:xt,canRemove:$=>$.type!=="chat"||$.id!==Ze,canDuplicate:$=>$.type!=="custom"})]}),u.jsx(Uz,{role:le,capabilities:he,session:e,urlToken:Q,onSyncAlert:_,onOpenConflicts:()=>g(!0)}),u.jsx($z,{alert:b,onDismiss:()=>_(null)}),v&&u.jsx(Hz,{urlToken:Q,onClose:()=>g(!1)}),Z&&u.jsx(FA,{items:RB.filter($=>!$.cap||he[$.cap]),bazaarItems:TB,onAdd:tn,onClose:()=>pe(!1)}),ce&&u.jsx(HA,{builtins:DB.filter($=>!$.cap||he[$.cap]),saved:Ee,onApply:kt,onSaveCurrent:Et,onDelete:H,onClose:()=>ge(!1)}),Pe&&u.jsx(YA,{theme:Ue,onChange:M,onClose:()=>{we(!1),re(null)},onPublish:he.chatWrite?Je:void 0,remixOf:ae}),Be&&u.jsx(ZA,{token:Q,session:e,onClose:()=>be(!1),onOpenTheme:()=>we(!0)}),C&&u.jsx(Gz,{token:Q,onApplyTheme:Fe,onRemixTheme:he.chatWrite?dt:void 0,onClose:()=>X(!1),onBuild:$=>{E({text:$,ts:Date.now()}),X(!1)}}),f&&u.jsx(Bz,{onClose:()=>m(!1),workspaceId:ne}),p&&u.jsx(Fz,{onClose:()=>y(!1),token:Q}),S&&u.jsxs("div",{className:"terminal-overlay","data-testid":"terminal-overlay",children:[u.jsxs("header",{children:[u.jsx("strong",{children:"Terminal"}),u.jsx("button",{onClick:()=>k(!1),children:"close"})]}),u.jsx(Pz,{token:Q})]})]})}function AB(e){const t=window.fetch.bind(window);window.fetch=(n,r={})=>{const i=typeof n=="string"?n:(n==null?void 0:n.url)||"";if(!(i.startsWith("/api/")||i.includes("://")===!1&&i.startsWith("api/")))return t(n,r);const o=new Headers(r.headers||{});return o.has("Authorization")||o.set("Authorization",`Bearer ${e}`),t(n,{...r,headers:o})}}function IB(){const e=window.fetch.bind(window);window.fetch=(t,n={})=>{const r=typeof t=="string"?t:(t==null?void 0:t.url)||"",i=r.startsWith("/api/")||r.includes("://")===!1&&r.startsWith("api/"),s=Is();if(!i||!s)return e(t,n);const o=new Headers(n.headers||{});return o.has("X-Workspace-Id")||o.set("X-Workspace-Id",s),e(t,{...n,headers:o})}}function MB(){Ch.createRoot(document.getElementById("root")).render(u.jsx(mr.StrictMode,{children:u.jsx(LB,{})}))}async function OB(){const e=typeof window<"u"&&window.fetch,t=e?new URLSearchParams(window.location.search).get("t"):null;if(t){let r=!1;try{const i=await window.fetch("/api/auth/exchange",{method:"POST",headers:{Authorization:`Bearer ${t}`}});r=i.ok&&(await i.json().catch(()=>({}))).cookie===!0}catch{}if(r){const i=new URLSearchParams(window.location.search);i.delete("t");const s=i.toString(),o=window.location.pathname+(s?`?${s}`:"")+window.location.hash;window.history.replaceState(null,"",o)}else AB(t)}IB();const n=e?new URLSearchParams(window.location.search).get("gv"):null;if(n){try{await window.fetch("/api/auth/google",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({vouch:n})})}catch{}const r=new URLSearchParams(window.location.search);r.delete("gv");const i=r.toString(),s=window.location.pathname+(i?`?${i}`:"")+window.location.hash;window.history.replaceState(null,"",s)}MB()}OB();
|